简体   繁体   中英

IIS7 403 - Access Denied

I am trying to deploy a website that I have built in mvc3 on an server that runs iis7. 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.

I have made sure I have the most recent .Net 4 framework using the asp_regiis.exe. I tried multiple application pools including the default. I allowed .net4 isapi. I have changed permission to allow access from 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).

I also have multiple other sites (using webforms, not mvc) working just fine on the server.

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.

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
  2. The "runAllManagedModulesForAllRequests" is set to false in your web.config
  3. The right version of MVC is not installed in the server
  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

For my part I forget to changed my logging directory path value in the web.config to an existing 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.

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).

After, for IIS, it looks like a problem with Authentication. Try to allow Anonymous authentication. On IIS manager, go to your website, click on the Authentication module and enabled "Anonymous Authentication".

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.

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.

A few things you should check.

  1. Did you set the directory that you unzipped your files in as an application in IIS? Is that application running .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. 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.

  1. Create a new MVC 3 internet app with all the defaults. Run on local IIS server.
  2. Move app to server and add it as an application.
  3. Test local access on the server (browse 80 from IIS manager).
  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

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. 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. Once you installed by default aspx file will be create.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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