Problems publishing an application in asp.net in IIS

0

I'm trying to publish my application on a windows server 2012 server with IIS 8. It fits step by step from "Site -> Add Website" to fill in with the coordinates, paths, and so on. I deployed in the appropriate default folder "Inetpub -> wwwroot", however I get the following errors when testing in the browse of the server itself or access the url from outside by my intranet.

ForChrome

Both of the above I am using through IIS to 'Authentication = Disabled'. When I go to 'Authentication = Enabled' this is the error:

Mywebconfiglookslikethis:

<?xmlversion="1.0" encoding="utf-8"?>

                       

                                 

<customErrors mode="Off"/>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
  <providers>
    <clear />
    <add name="CustomRoleProvider" type="Competências.Business.CustomRoleProvider" connectionStringName="DefaultConnection" applicationName="/"/>
  </providers>
</roleManager>

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

And my connectionstring:

public const string CONNECTION_STRING = @"Data Source=XXXXXX;Initial Catalog=Competências;User Id=integracao;Password=XXXXX;MultipleActiveResultSets=True;";
 public const string DEVELOPMENT_CONNECTION_STRING = @"Data Source=XXXXXX;Initial Catalog=Competências;Integrated Security=SSPI;MultipleActiveResultSets=True;";

What is missing properly configured to be able to publish my application?

    
asked by anonymous 14.10.2014 / 14:19

1 answer

1

The problem accused by the error page is that the user is blank. See the message:

Login failed for user ''

The single quotes at the end of the message indicate the name of the user being sent.

In your DEVELOPMENT_CONNECTION_STRING connection string, you use security integrated with windows. When you modified authentication to enabled = true, you most likely allowed anonymous authentication in IIS.

To fix, add the following configuration in web.config:

<system.web>
   <authentication mode="Windows" />
</system.web>

This setting will cause IIS to identify the user who is accessing your site and pass that user on to the database authentication.

Precautions: You should consider how best to authenticate users who will access this site. If this is an intranet site, this type of authentication might be the best way, otherwise I advise you to look for some authentication defaults for ASP.NET.

More information on how to modify IIS authentication mode, see this article at

14.10.2014 / 17:44