1
votes

I have a Application in Asp.net MVC running perfectly in Visual Studio 2015, with IIS EXPRESS (local computer).

I try execute this application in other computer (Windows Server 2008 R2 w/ IIS 7.5). I did a Deploy and i put in folder "C:\inetpub\wwwroot\testsite".

On execute localhost/testsite, the index page showying normaly, but, on submit the form (it's a login page), my IIS presents the "401.0 ERROR".

I am using "authentication mode forms":

<system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <authentication mode="Forms">
        <forms loginUrl="~/User/Login" timeout="2880" />
    </authentication>
</system.web>

Pool application is "DefaultAppPool". The Authentication: "Anonymous = ON", "Forms = ON", others options = OFF.

I tried various tips from other posts here from StackOverflow, But I could not solve my problem =(

Thanks!

2
Show the complete 401.0 error page. If you check carefully, other posts on SO are for 401.(something else), or their error pages are different. Before trying someone's tip, make sure first you hit exactly the same issue.Lex Li
I have the same problem. Did you ever find an answer?Diana
@Diana, i create a new IIS Application as subdomain. Previously I was trying to use in site.com/app, now i use in app.site.com and work. I do not remember many details, because they do 2 years xDvanderHobus
I know it's 2 years ago, but still: Thanks for your answer :) I wanted to let you know after two days of digging that for me, the problem was web.config inheritance. I had to put a lot of things of the main application's web.config in a <location> tag to prevent the subapplication from trying to use them.Diana

2 Answers

2
votes

Select the web application returning 401 - Unauthorized, and double-click the Authentication feature. Right-click the "Anonymous Authentication" provider and select edit. Switch the default anonymous user account ("IUSR") to ApplicationPoolIdentity. Now, right-click the web application in the left pane, select Edit Permissions..., select the Security tab, click Edit -> Add and add IIS APPPOOL\NameOfAppPool. Make sure the Application Pool Identity has read and execute permissions of the folder.

If you want to enable logging, check out this TechNet article: http://technet.microsoft.com/en-us/library/cc754631(WS.10).aspx

There is a setting for the anonymous user to use the credentials of the application pool identity or a specific user. Sometimes, it is defaulted to a specific user and not anonymous user If this is the issue in your case, following settings will hopefully fix it:

  1. IIS Manager → Sites → Website
  2. Double click "Authentication"
  3. Select Anonymous Authentication
  4. From the Actions panel, select Edit
  5. Select Application pool Identity and click ok
0
votes

Solution: It is not the way you would like to solve ... But the way it worked was creating a new subdomain for my application.