2013-03-11 72 views
0

我已經將我的網站發佈到網絡主機,但我有一些嚴重的數據庫問題。這是我的錯誤ASP.NET MVC 4數據庫錯誤

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. 

Line 255:   <providers> 
Line 256:    <add name="AspNetSqlMembershipProvider" 
Line 257:     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
Line 258:     connectionStringName="LocalSqlServer" 
Line 259:     enablePasswordRetrieval="false" 
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 257 

這是連接字符串到我的主機:

<connectionStrings> 
    <remove name="LocalSqlServer" /> 
    <add name="SiteSqlServer" connectionString="Server=(localhost);Database=ulprojec_******-***;uid=ulprojec_***;pwd=********a;" /> 

</connectionStrings> 

這是我從微軟的網站得到了我的會員連接字符串,但它仍然使第一個錯誤發生:

<membership defaultProvider="SiteSqlServer" 
     userIsOnlineTimeWindow="15"> 
     <providers> 
     <add 
      name="SiteSqlServer" 
      type="System.Web.Security.SqlMembershipProvider" 
      connectionStringName="SiteSqlServer" 
      applicationName="georgi-it" 
      enablePasswordRetrieval="false" 
      enablePasswordReset="true" 
      requiresQuestionAndAnswer="true" 
      requiresUniqueEmail="false" 
      passwordFormat="Hashed" 
      maxInvalidPasswordAttempts="5" 
      passwordAttemptWindow="10" /> 
     </providers> 
    </membership> 

我真的真的真的很贊成任何幫助,因爲我已經絕望了。

編輯:我整理了這一點

我現在有這個問題:

Exception Details: System.ArgumentException: Invalid value for key 'attachdbfilename'. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
+0

你見過[this](http://stackoverflow.com/questions/10984507/the-connection-name-localsqlserver-was-not-found-in-the-applications-configura)嗎? – 2013-03-11 23:47:49

+0

我假設你看過,你的配置文件不包含字符串「attachdbfilename」?這聽起來像是連接字符串的一部分。 – 2013-03-12 00:58:06

回答

1

那麼,如果錯誤是你收到此一意味着你正在使用的連接字符串「LocalSqlServer 「在以下部分:

<providers> 
Line 256:    <add name="AspNetSqlMembershipProvider" 
Line 257:     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
**Line 258:     connectionStringName="LocalSqlServer"** 
Line 259:     enablePasswordRetrieval="false" 

而在這裏,您正在刪除連接字符串。

<connectionStrings> 
    **<remove name="LocalSqlServer" />** 
    <add name="SiteSqlServer" connectionString="Server=(localhost);Database=ulprojec_******-***;uid=ulprojec_***;pwd=********a;" /> 

</connectionStrings> 

我想你可以看到你的連接字符串有一個簡單的命名問題。

+0

是的,我想通了,但現在我有另一個問題 – 2013-03-12 00:45:42

0

如果您未使用成員身份特徵,請從root web.cofig文件的system.web部分刪除成員資格,個人資料和roleManager標記。這幫助我解決了這個問題。

+0

究竟應該刪除什麼,從哪裏? – Michael 2016-01-29 13:26:10