简体   繁体   English

ASP.NET MVC3在IIS 7.5中

[英]ASP.NET MVC3 In IIS 7.5

Hi I want to publish an MVC 3 site in Windows Server 2008 R2 SP1. 嗨,我想在Windows Server 2008 R2 SP1中发布MVC 3站点。 I installed MVC 3 and MVC 2. When I created an MVC 2 site, it worked fine but the MVC 3 site did not work. 我安装了MVC 3和MVC 2.当我创建一个MVC 2站点时,它工作正常,但MVC 3站点不起作用。 I installed MVC 3 first and when the site did not work, I installed MVC 2 and tested the other (MVC 2) site and every thing was ok. 我首先安装了MVC 3,当网站不能正常工作时,我安装了MVC 2并测试了另一个(MVC 2)网站,一切都还可以。 The problems is MVC 3. 问题是MVC 3。

ANY HELP PLEASE Here is the error: 任何帮助请问这是错误:

Error Summary HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. 错误摘要HTTP错误403.14 - 禁止Web服务器配置为不列出此目录的内容。 Detailed Error Information Module DirectoryListingModule Notification ExecuteRequestHandler Handler StaticFile Error Code 0x00000000 Requested URL https://mywebsite.test.own:443/ Physical Path D:\\WebSite Logon Method Anonymous Logon User Anonymous Most likely causes: 详细错误信息模块DirectoryListingModule通知ExecuteRequestHandler处理程序StaticFile错误代码0x00000000请求的URL https://mywebsite.test.own:443 /物理路径D:\\ WebSite登录方法匿名登录用户匿名最可能的原因:

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Things you can try: 你可以尝试的事情:

If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
    Open IIS Manager.
    In the Features view, double-click Directory Browsing.
    On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Links and More Information This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. 链接和更多信息如果未在URL中指定文档,未为网站或应用程序指定默认文档,并且未对网站或应用程序启用目录列表,则会发生此错误。 This setting may be disabled on purpose to secure the contents of the server. 可以有意禁用此设置以保护服务器的内容。

View more information » 查看更多信息»

For ASP.NET MVC 3.0 on IIS 7.5 Windows Server 2008, I found that I had to run aspnet_regiis -i from the C:\\Windows\\Microsoft.NET\\Framework\\<version> folder. 对于IIS 7.5 Windows Server 2008上的ASP.NET MVC 3.0,我发现我必须从C:\\Windows\\Microsoft.NET\\Framework\\<version>文件夹运行aspnet_regiis -i This resolved the problem. 这解决了这个问题。

It looks like the request is going to the static file handler and is not getting into the MVC stack at all. 看起来请求转到静态文件处理程序并且根本没有进入MVC堆栈。 Some things to check... 有些事要检查......

In the config file do you have runAllManagedModulesForAllRequests set to true on the element? 在配置文件中,您是否在元素上将runAllManagedModulesForAllRequests设置为true?

Are you running in an application pool configured for .NET 4 and Integrated Pipeline mode? 您是否在为.NET 4和Integrated Pipeline模式配置的应用程序池中运行?

That's all I can think of right now, but if I have other thoughts I'll update the post. 这就是我现在所能想到的,但如果我有其他想法,我会更新帖子。

just in case these solutions did not work for someone, I ran into the same issue and finally tracked it down to a folder under my root directory named the same as an area. 为了防止这些解决方案对某人不起作用,我遇到了同样的问题,最后将其追踪到我的根目录下的一个文件夹,名称与一个区域相同。

For example, I had an area named "Users" and also a folder under my root directory named the same. 例如,我有一个名为“Users”的区域,以及我的根目录下名为相同的文件夹。 So "domain.com/users" was actually pointing to a folder under my root drive instead of an area. 所以“domain.com/users”实际上是指向我的根驱动器下的文件夹而不是区域。

Hope this helps someone! 希望这有助于某人!

The short answer is that you need to "Bin Deploy" the ASP.NET MVC 3 app. 简短的回答是你需要“Bin Deploy”ASP.NET MVC 3应用程序。

Please read Bin Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC . 请阅读Bin使用Razor将ASP.NET MVC 3部署到没有MVC的Windows Server Please also read Bin deploy for MVC 3 with Visual Studio 2010 SP1 . 另请阅读使用Visual Studio 2010 SP1阅读用于MVC 3的Bin部署

I was able to (partially) solve this problem by installing Visual Studio 2010 SP1 and then utilizing the Add Dependency Assemblies command. 我能够(部分)通过安装Visual Studio 2010 SP1然后使用Add Dependency Assemblies命令来解决此问题。

The reason I said that I was able to partially solve this problem is because this solution worked for my local IIS 7.5 on Windows 7 but has not worked for IIS 7 on a Windows Server 2008 R2. 我之所以能够部分解决此问题的原因是因为此解决方案适用于Windows 7上的本地IIS 7.5,但在Windows Server 2008 R2上无法用于IIS 7。 I am not sure if the problem is continuing or whether it is not a permissions issue. 我不确定问题是否仍在继续或是否是权限问题。 I have not had the chance to look at it in depth yet. 我还没有机会深入研究它。 Failed Request Tracing seems to suggest that it is the same issue as before, ie, 403.14. 失败的请求跟踪似乎表明它与以前的问题相同,即403.14。 I will update my answer when I know more. 当我知道更多时,我会更新我的答案。

  1. Right click on the your root project node in VS 2010 and select "Add Deployable Dependencies" and then choose: 右键单击VS 2010中的根项目节点,选择“Add Deployable Dependencies”,然后选择:

a) ASP .NET MVC a)ASP .NET MVC

b) ASP .NET Web Pages with Razor syntax b)具有Razor语法的ASP .NET网页

(Press OK and Publish the project) (按确定并发布项目)

  1. The element "runAllManagedModulesForAllRequests" of the web.config should be = "true". web.config的元素“runAllManagedModulesForAllRequests”应为=“true”。 (By Default it is TRUE) (默认情况下为TRUE)

  2. Under IIS 7.5 "Basic Settings" check if the website has Application pool like "ASP.NET v4.0" 在IIS 7.5“基本设置”下,检查网站是否具有“ASP.NET v4.0”之类的应用程序池

  3. Make sure if you downloads ALL files from the BIN folder. 确保从BIN文件夹下载所有文件。 Sometimes FileZilla gets stuck... So, check it twice. 有时FileZilla卡住......所以,检查两次。

I hope this will help! 我希望这个能帮上忙! :) :)

I had the same problem on Server 2008 x64 version. 我在Server 2008 x64版本上遇到了同样的问题。 ASP.NET MVC3 site does not work. ASP.NET MVC3站点不起作用。 I check everything in IIS. 我检查IIS中的所有内容。 The problem was solved only after turning on HTTP Redirection service in IIS role. 只有在IIS角色中启用HTTP重定向服务后才能解决该问题。

For Windows 7 check this location: Windows Features -> Internet Information Services -> World Wide Web Services -> Common HTTP features -> HTTP Redirection . 对于Windows 7,请检查以下位置: Windows Features -> Internet Information Services -> World Wide Web Services -> Common HTTP features -> HTTP Redirection

I was receiving this error when I deployed the Microsoft tutorial application ContsosoUniversity exactly according to the tutorial guidelines (http://www.asp.net/mvc/tutorials/deployment). 当我完全按照教程指南(http://www.asp.net/mvc/tutorials/deployment)部署Microsoft教程应用程序ContsosoUniversity时,我收到此错误。 After trying all the recommendations of multiple posts I resolved this problem by deleting all other applications in the root directory (from within IIS Manager) and re-deploying the application. 在尝试了多个帖子的所有建议后,我通过删除根目录中的所有其他应用程序(从IIS管理器中)并重新部署应用程序来解决此问题。 One of the other applications in the DefaultAppPool (within which it runs) must have been interfering. DefaultAppPool中的其他应用程序之一(运行它)必定是干扰的。

My actual problem was that I had mucked around with the _ViewStart.cshtml and _Layout.cshtml files. 我的实际问题是我使用了_ViewStart.cshtml_Layout.cshtml文件。 Specifically, I had changed the name of the _Layout.cshtml file to _PageLayout.cshtml and amended the references to it in _ViewStart.cshtml . 具体来说,我已将_Layout.cshtml文件的名称更改为_PageLayout.cshtml并在_ViewStart.cshtml修改了对它的_ViewStart.cshtml

That worked on VS2010 and on my home machine running Windows 7 32-bit, but it did not work on either my work machine running Windows 7 64-bit or my development server running Windows Server 2008 R2. 这适用于VS2010和运行Windows 7 32位的家用机器,但它在运行Windows 7 64位的工作机器或运行Windows Server 2008 R2的开发服务器上都无法运行。

The solution for me was to now try to change the name of _Layout.cshtml file. 我的解决方案是现在尝试更改_Layout.cshtml文件的名称。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM