Windows Server 2016上的IIS 10未运行我的ASP.NET MVC网站 [英] IIS 10 on Windows Server 2016 not running my ASP.NET MVC website

查看:601
本文介绍了Windows Server 2016上的IIS 10未运行我的ASP.NET MVC网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚购买了新的基于Windows Server 2016的基于云的虚拟机.我还要确保IIS 10已安装.NET Framework 4.6和ASP.NET 4.6.

I just bought a new Cloud based Virtual machine with Windows server 2016 installed. I also make sure IIS 10 has .NET Framework 4.6 and ASP.NET 4.6 installed.

我的ASP.NET MVC应用程序针对.NET 4.5,并已使用Web部署成功发布到此服务器上的默认网站". (您可以在此处查看所有asp.net mvc发布的文件)

My ASP.NET MVC application targets .NET 4.5 and is successfully published to the 'Default Web Site' on this server using Web deploy. (You can see all the asp.net mvc published files here)

默认网站"使用具有v4.0 .NET CLR版本的"DefaultAppPool".

'Default Web Site' uses 'DefaultAppPool' which has a v4.0 .NET CLR Version.

但是,当我在浏览器中打开网页时,我收到了"403-禁止访问被拒绝"的信息.错误.我进行了研究,对我而言,IIS似乎从未尝试将其作为ASP.NET MVC应用程序打开.它只是尝试查找与'controller/Action'.html同名的物理文件,当然找不到.我尝试过的解决方案:

But when I open the web page in my browser, I received a '403 - Forbidden: Access is denied.' error. I did my research, to me it looks like the IIS never tried to open it as a ASP.NET MVC application. It simply tries to find a physical file with the same name as 'controller/Action'.html and of course it couldn't find it. Solutions I have tried with:

  1. 还有另一篇文章提到IIS模块配置中的"UrlRoutingModule-4.0".就我而言,路由模块由于某种原因不存在.我添加了它,但是没有任何变化.此外,每次我从VS重新发布网站时,部署成功后该模块都会消失.

  1. There's another post mentioning the 'UrlRoutingModule-4.0' in IIS Modules configuration. 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.

我还尝试将<modules runAllManagedModulesForAllRequests="true"/> 添加到我的webconfig文件中,也没有运气.

I also tried adding <modules runAllManagedModulesForAllRequests="true"/> to my webconfig file, no luck either.

在服务器上运行aspnet_regiis -ir.它说该命令不能在此操作系统上运行,但无论如何仍然可以运行它.但是,问题仍然存在.

Run aspnet_regiis -ir on the server. It says the command can't be run on this operating system but still run it anyway. However, the problem is still there.

推荐答案

我终于成功了!!

解决方案是转到控制面板,然后单击打开和关闭Windows功能",然后转到服务器角色"->"Web服务器(IIS)"->"Web服务器"->应用程序开发" ,在这里您需要确保同时安装了".NET可扩展性4.6"和"ASP.NET 4.6".

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.

显然,当安装IIS 10时,默认情况下将不会安装它们.谢谢大家的帮助.

Apparently when IIS 10 is installed, these will not be installed by default. Thanks guys for all the help.

这篇关于Windows Server 2016上的IIS 10未运行我的ASP.NET MVC网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆