我有一个ASP.NET核心应用程序作为一个Azure托管在一个url下面:
https://my-webapp-url.azurewebsites.net/这是我的web配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" />
</requestFiltering>
</security>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\My.WebApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>任何用户都可以访问:
https://my-webapp-url.azurewebsites.net/info页面https://my-webapp-url.azurewebsites.net/swagger页面我的问题是:
https://my-webapp-url.azurewebsites.net/my-extra-file.html这样的硬编码路径,这样在请求这个URL时,HTML页面就会返回?目前,如果我将my-extra-file.html放在web应用程序的wwwroot dir中,并且我尝试访问https://my-webapp-url.azurewebsites.net/my-extra-file.html,我将得到404.0。
事先谢谢您,并为您的任何错误道歉。
发布于 2019-03-22 08:29:24
我将进行总结,并将其作为答复邮寄。
当您使用Asp.net核心mvc应用程序时,需要在Startup类的Configure方法中添加app.UseStaticFiles();。这样,and服务器就可以像html、css、javascript和image这样的静态文件提供服务器。
然后在.html文件夹下创建wwwroot文件,您将访问它。
https://stackoverflow.com/questions/55245705
复制相似问题