Azure 网络应用程序。 IIS 10. 网络配置。 运行 带有 ASP.NET 核心应用程序的静态文件
Azure Web App. IIS 10. Web Config. Running a static file with a ASP.NET Core app
我有一个 ASP.NET 核心应用程序作为 Azure Web 应用程序托管在 url:
https://my-webapp-url.azurewebsites.net/
这是我的网络配置:
<?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
页面以查看我的应用程序的 API 文档
我的问题如下:
- 需要做什么才能允许用户访问像
https://my-webapp-url.azurewebsites.net/my-extra-file.html
这样的硬编码路径,以便在请求此 URL 时 HTML 页面将 return?
目前,如果我在 Web 应用程序的 wwwroot
目录中有 my-extra-file.html
,并且我尝试访问 https://my-webapp-url.azurewebsites.net/my-extra-file.html
,我会得到 404.0.
在此先感谢您,对于任何错误,我们深表歉意。
我会总结一下post作为回复
当您使用Asp.net核心mvc应用程序时,您需要在Startup
class的Configure
方法中添加app.UseStaticFiles();
。这样网络服务器就可以为 html、css、javascript 和图像等静态文件提供服务。
然后在 wwwroot
文件夹下创建 .html 文件,您将可以访问它。
我有一个 ASP.NET 核心应用程序作为 Azure Web 应用程序托管在 url:
https://my-webapp-url.azurewebsites.net/
这是我的网络配置:
<?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
页面以查看我的应用程序的 API 文档
我的问题如下:
- 需要做什么才能允许用户访问像
https://my-webapp-url.azurewebsites.net/my-extra-file.html
这样的硬编码路径,以便在请求此 URL 时 HTML 页面将 return?
目前,如果我在 Web 应用程序的 wwwroot
目录中有 my-extra-file.html
,并且我尝试访问 https://my-webapp-url.azurewebsites.net/my-extra-file.html
,我会得到 404.0.
在此先感谢您,对于任何错误,我们深表歉意。
我会总结一下post作为回复
当您使用Asp.net核心mvc应用程序时,您需要在Startup
class的Configure
方法中添加app.UseStaticFiles();
。这样网络服务器就可以为 html、css、javascript 和图像等静态文件提供服务。
然后在 wwwroot
文件夹下创建 .html 文件,您将可以访问它。