简体   繁体   English

IIS7 403 - 拒绝访问

[英]IIS7 403 - Access Denied

I am trying to deploy a website that I have built in mvc3 on an server that runs iis7. 我正在尝试在运行iis7的服务器上部署我在mvc3中构建的网站。 I was able to get it running through the iis7 locally on my laptop, but when I try to put it on the server I get a 403 access denied error when trying to get to it remotely and a "connection has timed out" when I try to view it from the server itself. 我能够在我的笔记本电脑上本地运行iis7,但是当我尝试将它放在服务器上时,我尝试远程访问它时出现403访问被拒绝错误,并且当我尝试“连接已超时”时从服务器本身查看它。

I have made sure I have the most recent .Net 4 framework using the asp_regiis.exe. 我确保使用asp_regiis.exe获得最新的.Net 4框架。 I tried multiple application pools including the default. 我尝试了多个应用程序池,包括默认值。 I allowed .net4 isapi. 我允许.net4 isapi。 I have changed permission to allow access from IUSER, SERVER NETWORK, Authenticated Users. 我已更改允许IUSER,SERVER NETWORK,Authenticated Users访问的权限。 I have made sure the default document list is the same as the one on my laptop iis7 (which works fine). 我已经确定默认文档列表与我的笔记本电脑iis7上的相同(工作正常)。

I also have multiple other sites (using webforms, not mvc) working just fine on the server. 我还有多个其他网站(使用webforms,而不是mvc)在服务器上正常工作。

Could it have something to do with the way I passed to files to the server? 它可能与我传递给服务器的文件的方式有关吗? I just zipped the files up and placed them (and unzipped them) on the server and directed iis to the created directory. 我只是将文件压缩并将它们(并解压缩)放在服务器上,并将iis定向到创建的目录。

What am I missing? 我错过了什么?

I faced this error last week and it can be caused by many things: 我上周遇到了这个错误,可能是由许多事情造成的:

  1. The right version of the .NET framework is not installed or registered with asp_regiis.exe 未使用asp_regiis.exe安装或注册正确版本的.NET框架
  2. The "runAllManagedModulesForAllRequests" is set to false in your web.config web.config中的“runAllManagedModulesForAllRequests”设置为false
  3. The right version of MVC is not installed in the server MVC的正确版本未安装在服务器中
  4. You have an ignore route which ignores your request 你有一个忽略你的请求的忽略路线
  5. You have an early exception in your Application_Start and your site doesn't start properly 您的Application_Start中存在早期异常,并且您的站点无法正常启动

For my part I forget to changed my logging directory path value in the web.config to an existing directoy. 就我而言,我忘记将web.config中的日志目录路径值更改为现有的directoy。

What you can do to know if it's an configuration error or an error in your application is to create a new default MVC project in VS and to deploy it in the same apppool. 如果是配置错误或应用程序中的错误,您可以做的是在VS中创建一个新的默认MVC项目并将其部署在同一个apppool中。

Instead of zipping your app, it will be better if you can publish it (in VS, right click on your project and publish) and after deploy it to your website (you have several options). 如果您可以发布它(在VS中,右键单击您的项目并发布)并将其部署到您的网站(您有多个选项),而不是压缩您的应用程序。

After, for IIS, it looks like a problem with Authentication. 之后,对于IIS,它看起来像身份验证的问题。 Try to allow Anonymous authentication. 尝试允许匿名身份验证。 On IIS manager, go to your website, click on the Authentication module and enabled "Anonymous Authentication". 在IIS管理器上,转到您的网站,单击“身份验证”模块并启用“匿名身份验证”。

Let's see what happen after that even if the "time out" problem is strange .... Just to be sure, by default it is disabled to browse the content of a website and you will have a 403 error if you tried to do it. 让我们看看之后会发生什么,即使“超时”问题很奇怪......只是为了确定,默认情况下它被禁用以浏览网站的内容,如果你试图这样做会有403错误。

Where did you put your app? 你把你的应用放在哪里了? Sometimes it can be problematic (for access configuration) to put it in specific folders like Programs files, etc etc. Try to install it at the root such as C:\\Websites\\MyApp just to test without user permission problems. 有时可能会出现问题(对于访问配置)将其放在特定文件夹(如程序文件等)等。尝试在根目录下安装它,例如C:\\ Websites \\ MyApp,以便在没有用户权限问题的情况下进行测试。

A few things you should check. 你应该检查一些事情。

  1. Did you set the directory that you unzipped your files in as an application in IIS? 您是否设置了将文件解压缩为IIS中的应用程序的目录? Is that application running .NET 3.5/4.0? 该应用程序是否运行.NET 3.5 / 4.0?

  2. Is your pipeline for the application pool running the application you have created above running in Integrated Mode or Classic Mode? 运行上面创建的应用程序的应用程序池的管道是在集成模式还是经典模式下运行?

Typically, when deploying an MVC app, a 403 is not a permission issue. 通常,在部署MVC应用程序时,403不是权限问题。 It is telling you that directory browsing is not allowed. 它告诉你不允许目录浏览。 This is because without either of the 2 items above (or a custom wildcard mapping in IIS), the web server does not know how to handle routing, the basis of an MVC app. 这是因为如果没有上述两个项目之一(或IIS中的自定义通配符映射),Web服务器就不知道如何处理路由,这是MVC应用程序的基础。

  1. Create a new MVC 3 internet app with all the defaults. 使用所有默认值创建一个新的MVC 3互联网应用程序。 Run on local IIS server. 在本地IIS服务器上运行。
  2. Move app to server and add it as an application. 将应用程序移动到服务器并将其添加为应用程序。
  3. Test local access on the server (browse 80 from IIS manager). 测试服务器上的本地访问(从IIS管理器浏览80)。
  4. Don't shotgun twiddle all the permissions until you figure out the problem. 在找出问题之前,请不要霰弹枪旋转所有权限。
  5. See my blog http://blogs.msdn.com/b/rickandy/archive/2011/04/22/test-you-asp-net-mvc-or-webforms-application-on-iis-7-in-30-seconds.aspx 请参阅我的博客http://blogs.msdn.com/b/rickandy/archive/2011/04/22/test-you-asp-net-mvc-or-webforms-application-on-iis-7-in-30 -seconds.aspx

You need to make sure that the folder where you unzipped the files has the right permissions setup. 您需要确保解压缩文件的文件夹具有正确的权限设置。 Also, do you have authentication setup in that site? 此外,您是否在该站点中进行了身份验证设置?

While setting up website, have you tested your IIS settings by clicking on test connection. 在设置网站时,您是否通过单击测试连接测试了IIS设置。 Did you get two green ticks. 你有两个绿色的蜱虫吗? If not please check your Authentication settings. 如果没有,请检查您的验证设置。 folder access settings and application pool settings. 文件夹访问设置和应用程序池设置。

If it is aspx file Make sure the default page as been set on the IIS, if not install the asp.net application. 如果是aspx文件确保在IIS上设置了默认页面,如果没有安装asp.net应用程序。 Once you installed by default aspx file will be create. 默认安装后,将创建aspx文件。

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

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