मेरे पास एक वेब एपीआई 2 प्रोजेक्ट है। यह ओविन का उपयोग करके स्वयं होस्ट करने के लिए कॉन्फ़िगर किया गया है। इसमें कोई वैश्विक.एक्सएक्स फ़ाइल नहीं है। मुझे वेब एपीआई के लिए सहायता पृष्ठ की आवश्यकता है, और इसके लिए swaschbuckle का उपयोग किया है। लेकिन rooturl/swagger/docs कोई आउटपुट नहीं दे रहा है। मैंने यहां दिए गए निर्देशों का पालन किया है 'https://github.com/domaindrivendev/Swashbuckle/issues/196', लेकिन यह अभी भी काम नहीं कर रहा है। नीचे मेरा कॉन्फ़िगरेशन कोडस्वाशबकल स्वेगर काम नहीं कर रहा है
public void Configuration(IAppBuilder app) { // Configure DI container = BuildDI(); // Create the configuration. OWIN Should create a new httpconfiguration. // GlobalConfiguration can't be used. HttpConfiguration = new HttpConfiguration(); HttpConfiguration.Formatters.XmlFormatter.UseXmlSerializer = true; HttpConfiguration.MapHttpAttributeRoutes(); HttpConfiguration.DependencyResolver = new AutofacWebApiDependencyResolver(container); // Set ServicePointManager properties. ServicePointManager.ServerCertificateValidationCallback = ((sender, cert, chain, sslPolicyErrors) => true); // 10 concurrent connections can be made on the service point. ServicePointManager.DefaultConnectionLimit = 10; // After the idle time expires, the ServicePoint object is eligible for // garbage collection and cannot be used by the ServicePointManager object. ServicePointManager.MaxServicePointIdleTime = 30000; // 30 Seconds. app.UseSerilogRequestContext("RequestId"); // Middleware is injected form DI. app.UseAutofacMiddleware(container); app.UseAutofacWebApi(HttpConfiguration); //Enable swashbuckle SwaggerConfig.Register(HttpConfiguration); // Webapi middleware. Do it at the end. app.UseWebApi(HttpConfiguration); // Register callback to dispose container. RegisterShutdownCallback(app, container); } --------------------------------------------------------------- public class SwaggerConfig { public static void Register(HttpConfiguration config) { config.EnableSwagger(c => { c.RootUrl(rurl => ConfigurationManager.AppSettings["hostUrl"].ToString()); c.IncludeXmlComments(GetXmlCommentsFileLocation()); c.SingleApiVersion("v1", "Isone"); }) .EnableSwaggerUi(c => { }); } private static string GetXmlCommentsFileLocation() { var baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\bin"; var commentsFileName = Assembly.GetExecutingAssembly().GetName().Name + ".XML"; var commentsFileLocation = Path.Combine(baseDirectory, commentsFileName); return commentsFileLocation; } } --------------------------------------------------------------
कोड में कोई भी गलती बताएं।