简体   繁体   English

Windows Server 2016 上的 IIS 10 未运行我的 ASP.NET MVC 网站

[英]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:我尝试过的解决方案:

  1. 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重新发布网站时,模块在部署成功后消失。

  2. I also tried adding <modules runAllManagedModulesForAllRequests="true"/> to my webconfig file, no luck either.我还尝试将<modules runAllManagedModulesForAllRequests="true"/>到我的 webconfig 文件中,但也没有运气。

  3. 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模块的说明

Installing IIS and ASP.NET Modules 安装IIS和ASP.NET模块

暂无
暂无

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

相关问题 Asp.Net httpcontext.current.request在运行iis7的虚拟Windows Server 2012上有效,但在Windows Server 2016 iis10上无效 - Asp.Net httpcontext.current.request works on virtual windows server 2012 running iis7 but not on windows server 2016 iis10 我无法访问我在 windows 服务器 2016 中的 iis 下托管的 asp.net 核心服务器 - I cannot reach my asp.net core server hosted under iis in windows server 2016 IE10和Windows 8以及ASP.NET MVC(IIS 7) - IE10 and Windows 8 and ASP.NET MVC (IIS 7) 将ASP.NET MVC网站部署到IIS 8 - Deploy asp.net mvc website to iis 8 ASP.NET 核心 ILogger Memory Windows 10 (1607) / ZAEA2342289CE3AA9B340Z6 服务器泄漏 - ASP.NET Core ILogger Memory Leak on Windows 10 (1607) / Windows Server 2016 如何将 ASP.NET 核心 web 应用程序部署到 ZAEA23489CE3AA9B6406EBB28E0CDA4016 上的 IIS 应用程序 - How to deploy ASP.NET core web application to IIS on Windows Server 2016 我无法在从IIS Windows 7运行的ASP.net网站上显示来自sql server 2005的数据 - I cannot display data from sql server 2005 express on an ASP.net website running from IIS windows 7 在未安装VisualStudio或IIS的Windows中托管ASP.NET MVC4网站 - Host ASP.NET MVC4 website in windows without VisualStudio or IIS installed in it 通过IIS启动我的ASP.NET MVC网站时找不到指定的文件 - Specified file not found when launching my ASP.NET MVC website through IIS IIS 10 ASP.NET 4.5.2 MVC应用程序上的403.14错误 - 403.14 Error on IIS 10 ASP.NET 4.5.2 MVC Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM