繁体   English   中英

Swagger Ui 不会在 asp.net mvc 上加载静态文件

[英]Swagger Ui not load static files on asp.net mvc

我在我的 asp.net mvc 中使用 swagger ui

Swashbuckle v 5.6
asp.net v 4.8

在本地机器上,everythink 工作成功,但不幸的是,在将网站部署到云后,swagger 没有加载静态内容,但是我使用 chrome 导航到这些资源,它已成功加载

我配置招摇使用:

    public static void Register()
    {
        var thisAssembly = typeof(SwaggerConfig).Assembly;
        GlobalConfiguration.Configuration
            .EnableSwagger(c =>
             {
                 c.Schemes(new[] { "http", "https" });
                 c.IgnoreObsoleteActions();
                 c.SingleApiVersion("v1", "Console - API");
                 c.ApiKey("auth")
                     .Description("API Key Authentication")
                     .Name("auth")
                     .In("header");
                 c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
                 c.IncludeXmlComments(String.Format(@"{0}\bin\docs.xml", System.AppDomain.CurrentDomain.BaseDirectory));
                 c.UseFullTypeNameInSchemaIds();
             })
            .EnableSwaggerUi(c =>
            {
                c.DocumentTitle("Console - API");
                c.EnableApiKeySupport("auth", "header");
                c.InjectJavaScript(thisAssembly, "Console.API.Assets.Swagger.SwashbuckleCustomAuth.js");
                c.InjectStylesheet(thisAssembly, "Console.API.Assets.Swagger.SwashbuckleCustomStyle.css");
            });
    }

在此处输入图片说明

我想念什么吗? 剂量 https 效果招摇加载静态文件?

pss:我认为这个问题与 iis 无关,因为我在网站的根文件夹中放置了一个静态文件并且我能够加载它

IIS 是阻塞并发请求,解决方案是在 IIS 的站点提前设置中增加最大并发连接数

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM