我的主机上有一些页面(Web表单),这些页面可从MSSQL服务器检索一些信息并可以正常运行,但是我的问题是我的“登录”页面。
在我的登录页面中,当用户输入错误的用户名或密码时,表单正常运行并向用户显示相关消息,但是如果正确输入用户名和密码,则会引发附件错误。
我认为这与“成员资格”有关,但我不知道。这是我的“web.config”文件:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="JahanPay.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<JahanPay.Properties.Settings>
<setting name="JahanPay_com_jahanpay_Webservice2ControllerService"
serializeAs="String">
<value>http://jahanpay.com/webservice2/index?ws=1</value>
</setting>
</JahanPay.Properties.Settings>
</applicationSettings>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=127.0.0.1;Initial Catalog=ASPNETDB;Integrated Security=False;User ID=something;Password=something;Connect Timeout=15;Encrypt=False;Packet Size=4096" />
</connectionStrings>
<system.web>
<roleManager enabled="true" defaultProvider="SqlProvider" >
<providers>
<clear/>
<add name="SqlProvider" type="System.Web.Security.SqlRoleProvider"
connectionStringName="ConnectionString" applicationName="/" />
</providers>
</roleManager>
<authentication mode="Forms" >
<forms loginUrl="users/signin.aspx" timeout="30"></forms>
</authentication>
<compilation debug="true" targetFramework="4.0"/>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionString" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" applicationName="/" />
</providers>
</membership>
<profile>
<properties>
<clear/>
<add name="username"/>
<add name="userfamily"/>
<add name="companyname"/>
<add name="sex" type="boolean"/>
<add name="mobile"/>
<add name="birthday" type="DateTime"/>
</properties>
</profile>
<customErrors mode="Off"/>
</system.web>
<location path="userpanel">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="Service">
<endpoint address="" behaviorConfiguration="ServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="Service" />
</service>
</services>
</system.serviceModel>
</configuration>
我该怎么办?
再一次,因为我认为很重要,所以我提到只有在用户尝试使用正确的用户名和密码登录时才会发生。
最佳答案
您的SQL Server无法访问。如果通过网络连接,请尝试ping服务器。如果sqlserver应该在您的PC上,请尝试重新启动sqlserver。
关于c# - ASP.Net在登录时引发错误-建立与SQL Server的连接时发生与网络相关或特定于实例的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33212830/