Domanda

I am a newbie in ASP.net and just following Tutorials. This Particular Problem has been Giving me a Real Headache, I have developed a website in VS 2010 , used the ASPNETDB SQL server database provided by Asp.Net Login Controls for creating users and roles. Also added Some tables, After i Was Done Used the " publish to Provider " feature to generate the Script (ASPNETDB.MDF.sql) . I Used this Script to Generate the Database and Tables -Sql Server 2008 R2 management Studio, and Modified the web.config Like This-

<!--Connection String-->
                <connectionStrings>
        <remove name="LocalSqlServer" />
        <add name="LocalSqlServer"  connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=true" providerName="System.Data.SqlClient" />
                <add name="con" connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True"/>
                <add name="ConnectionString" connectionString="Server=AkumJamir-PC\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<roleManager enabled="true">
        <providers>
            <remove name="AspNetSqlRoleProvider"/>
            <add connectionStringName="ConnectionString" applicationName="/"
                 name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider,System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            <remove name="AspNetWindowsTokenProvider"/>
        </providers>
    </roleManager>

<membership>
        <providers>
            <remove name="AspNetMembershipProvider"/>
            <add connectionStringName="ConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphaNumericCharacters="1" passwordAttemptWindow="5" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </providers>
    </membership>   
    <webParts>
        <personalization defaultProvider="AspNetSqlPersonalizationProvider">
            <providers>
                <remove name="AspNetSqlPersonalizationProvider"/>
                <add name="AspNetSqlPersonalizationProvider" type="System.Web.UI.WebControls.Webparts.SqlPersonalizationProvider"
                 connectionStringname="ConnectionString" applicationName="/"/>
            </providers>
        </personalization>
    </webParts>

Now The Problem is That Works On my Development Machine But on our Staging Server, It Doesnt connect to the Database whenever i try browse to Some Pages where i have some data to be displayed from the Database Neither Does the Login Page Work.The connectionString Looks Like This in the Server:

<!--Connection String-->
                <connectionStrings>
        <remove name="LocalSqlServer" />
        <add name="LocalSqlServer"  connectionString="Driver={SQL Native Client};Server=WIN-K16NMM4128C;Initial Catalog=ASPNETDB;Integrated Security=true" providerName="System.Data.SqlClient" />
                <add name="con" connectionString="Server=WIN-K16NMM4128C;Initial Catalog=ASPNETDB;Integrated Security=True"/>
                <add name="ConnectionString" connectionString="Data Source=WIN-K16NMM4128C\SqlServer2008;Initial Catalog=ASPNETDB;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>

I Am Eating My braings Away, I've Gone through the Topics Covered Already,,,, Thanks For any Advise...

È stato utile?

Soluzione

You are using integrated security in your connection strings. Configure it to use sql authentication. Something like this:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Altri suggerimenti

I was facing the same issue. I've just enabled ASP/Authentication in IIS manager and I've set Basic Authentication=true. It is working now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top