1
I am trying to publish my application on a Windows server 2012 with IIS 8. I have taken the step by step to go to "Site -> Add Website" and fill in the coordinates, paths and etc. I have deployed it in the default folder "Inetpub -> wwwroot"but I get the following error when testing on the server itself:
My application is windows Authentication. The connection, url, Ip are ok. Local I can normally access the application and database that are on another server, but on IIS when publishing I can’t. This error occurs when I leave 'Enabled' for Anonymous Authentication and 'Disabled' for Windows Authentication. When I reverse the authentication then pop up to pass my login credentials, but it does not accept any login I try and after 3 attempts gives the error:
HTTP Error 401.1 - Unauthorized You do not have permission to view this directory or page using the credentials that you supplied.
I found that disabling windows Authentication and in the url, passing the name of a view later (meusite.br/godmaview) page appears but does not load my data that should be loaded since my application is windows Authentication.
My web config and connection string:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="BancoContext" connectionString="Data Source=(localdb)\v11.0; Initial Catalog=BancoContext-20140116130500; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|BancoContext-20140116130500.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
<providers>
<clear />
<add name="CustomRoleProvider" type="Banco.Business.CustomRoleProvider" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</roleManager>
<authentication mode="Windows" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<globalization uiCulture="pt-BR" culture="pt-BR" enableClientBasedCulture="true" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />
<authorization>
<deny users="?" />
</authorization>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
public const string CONNECTION_STRING = @"Data Source=Servidor;Initial Catalog=Banco;User Id=integracao;Password=00000;MultipleActiveResultSets=True;";
public const string DEVELOPMENT_CONNECTION_STRING = @"Data Source=Servidor;Initial Catalog=Banco;Integrated Security=SSPI;MultipleActiveResultSets=True;";
You have to enable Directory Search (Browsing) to see files when you don’t have Standard Document. http://technet.microsoft.com/pt-br/library/cc731109(v=Ws.10). aspx
– Tony
I already enabled. I also created the defaul page but keeps giving the same error.
– PFVictor
You have defined which Application Pool for this website?
– Leonel Sanches da Silva
I already tried the default, the one created with the same name as the website and with . NET v4.5 @Ciganomorrisonmendez
– PFVictor
@Tony found that passing the URL plus the name of a view (my-page.br/nameanew) opens on the corresponding page of my program, only without authentication with the user data as it should appear.
– PFVictor
And the home page does not open although I have already put her name in 'Default Document'
– PFVictor
@Ciganomorrisonmendez gave an edited question.
– PFVictor