我们使用以下技术开发了ASP.NET MVC版本5.2.7.0应用程序:
-ASP.NET MVC版本5.2.7.0
-。NET Framework 4.6.1
-Visual Studio 2019
我们必须将所述应用程序部署到包含独立IIS服务器的以下环境中:
-32位环境
-Windows Server 2008 R2 Enterprise(Service Pack 1)
-IIS版本7.5
-8 GB RAM
这是典型的ASP.NET MVC设置和配置:
public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } } public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); ................................... .................................................
...................................................... .........
当我在Visual Studio 2019调试模式下运行它时它可以工作,因为它显示带有应用程序标题的默认登录页面。
但是,当我将其部署到独立的IIS服务器上,然后在IIS管理器中单击“浏览”时,出现以下错误:
HTTP错误403.14-禁止使用
未为请求的URL配置默认文档,并且 服务器上未启用目录浏览。
这真的很奇怪,因为在独立的IIS服务器上,有问题的应用程序具有一个bin目录,其中包含ASP.NET MVC所需的必需文件:
System.Web.Helpers.dll System.Web.Http.dll System.Web.Http.WebHost.dll System.Web.Mvc.dll System.Web.Optimization.dll System.Web.Razor.dll System.Web.WebPages.Deployment.dll System.Web.WebPages.dll System.Web.WebPages.Razor.dll System.Xml.ReaderWriter.dll System.Xml.XDocument.dll System.Xml.XmlDocument.dll System.Xml.XmlSerializer.dll System.Xml.XPath.dll System.Xml.XPath.XDocument.dll
有人可以告诉我如何解决独立IIS服务器上的上述错误吗?
原因可能很简单,我们需要启用某些Windows功能以支持Asp.NET平台Web应用程序。https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configuring-step-1-install-iis-and-asp-net-modules随时让我知道问题是否仍然存在。