[英]IIS 10 on Windows Server 2016 not running my ASP.NET MVC website
I just bought a new Cloud based Virtual machine with Windows server 2016 installed.我刚刚购买了一台安装了 Windows Server 2016 的新的基于云的虚拟机。 I also make sure IIS 10 has .NET Framework 4.6 and ASP.NET 4.6 installed.
我还确保 IIS 10 安装了 .NET Framework 4.6 和 ASP.NET 4.6。
My ASP.NET MVC application targets .NET 4.5 and is successfully published to the 'Default Web Site' on this server using Web deploy.我的 ASP.NET MVC 应用程序面向 .NET 4.5,并使用 Web 部署成功发布到此服务器上的“默认网站”。 (You can see all the asp.net mvc published files here)
(你可以在这里看到所有asp.net mvc发布的文件)
'Default Web Site' uses 'DefaultAppPool' which has a v4.0 .NET CLR Version. “默认网站”使用具有 v4.0 .NET CLR 版本的“DefaultAppPool”。
But when I open the web page in my browser, I received a '403 - Forbidden: Access is denied.'但是当我在浏览器中打开网页时,我收到了“403 - 禁止访问:拒绝访问”。 error.
错误。 I did my research, to me it looks like the IIS never tried to open it as a ASP.NET MVC application.
我做了我的研究,在我看来 IIS 从未尝试将它作为 ASP.NET MVC 应用程序打开。 It simply tries to find a physical file with the same name as 'controller/Action'.html and of course it couldn't find it.
它只是试图找到一个与 'controller/Action'.html 同名的物理文件,当然它找不到它。 Solutions I have tried with:
我尝试过的解决方案:
There's another post mentioning the 'UrlRoutingModule-4.0' in IIS Modules configuration.还有一篇文章提到了 IIS 模块配置中的“UrlRoutingModule-4.0”。 In my case, the routing module is not there for some reason.
就我而言,路由模块由于某种原因不存在。 I added it, but nothing changes.
我添加了它,但没有任何改变。 Furthermore, every time I republish the website from VS, the module disappears after the deployment succeeds.
此外,每次我从VS重新发布网站时,模块在部署成功后消失。
I also tried adding <modules runAllManagedModulesForAllRequests="true"/>
to my webconfig file, no luck either.我还尝试将
<modules runAllManagedModulesForAllRequests="true"/>
到我的 webconfig 文件中,但也没有运气。
Run aspnet_regiis -ir on the server.在服务器上运行 aspnet_regiis -ir。 It says the command can't be run on this operating system but still run it anyway.
它说该命令无法在此操作系统上运行,但仍然可以运行。 However, the problem is still there.
然而,问题仍然存在。
I finally got it work!!! 我终于搞定了!
The solution is go to control panel and then click 'Turn windows feature on and off', then go to 'Server Roles' -> 'Web Server (IIS)' -> 'Web Server' -> 'Application Development', here you need to make sure both '.NET Extensability 4.6' and 'ASP.NET 4.6' are installed. 解决方案是转到控制面板,然后单击“打开和关闭Windows功能”,然后转到“服务器角色” - >“Web服务器(IIS)” - >“Web服务器” - >“应用程序开发”,在此处需要确保安装了“.NET Extensability 4.6”和“ASP.NET 4.6”。
Apparently when IIS 10 is installed, these will not be installed by default. 显然,当安装IIS 10时,默认情况下不会安装这些。 Thanks guys for all the help.
谢谢大家的帮助。
the reason is asp.net mvc isn't installed completely on the machine. 原因是asp.net mvc没有完全安装在机器上。
please read the instruction of install IIS and ASP.NET Modules 请阅读安装IIS和ASP.NET模块的说明
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.