2010-04-02 48 views
0

當過我部署到我的帳戶winhost並嘗試使用成員資格提供它的工作原理罰款本地登錄,但我已經遇到了一個奇怪的問題中發現的一旦它在Intarnets上破裂。WinHost,配置錯誤,「LocalSqlServer」沒有在應用程序配置或連接字符串

Configuration Error 

Description: An error occurred during the processing of a configuration file require 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. 

Source Error: 
Source File: machine.config Line: 148 

這是因爲如果我在我的app.config引用「LocalSqlServer」的地方,但我沒有在這裏被我的供應商:

<membership defaultProvider="SqlProvider"> 
    <providers> 
    <clear/> 
    <add name="SqlProvider" 
     connectionStringName="winhost" 
     enablePasswordRetrieval="false" 
     enablePasswordReset="true" 
     requiresQuestionAndAnswer="false" 
     passwordFormat="Hashed" 
     applicationName="TestAdmin" 
     minRequiredNonalphanumericCharacters="0" 
     minRequiredPasswordLength="2" 
     type="System.Web.Security.SqlMembershipProvider" /> 
    </providers> 
</membership> 

<authentication mode="Forms"/> 
<roleManager enabled="true"> 
    <providers> 
    <clear/> 
    <add name="AspNetSqlRoleProvider" 
     type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
     connectionStringName="winhost" 
     applicationName="TestAdmin"/> 
    </providers> 
</roleManager> 

任何意見或幫助表示讚賞!

Josh

回答

1

看看你的錯誤信息的底部。這是不是在談論app.config;而是machine.config

<root drive>:\<windows>\Microsoft.NET\Framework\<version>\config\machine.config

這是它看起來像我的:

<roleManager> 
     <providers> 
      <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
      <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
     </providers> 
    </roleManager> 
+0

所以我想我需要聯繫我的託管服務提供商,看看他們是否能解決問題。 – jr3 2010-04-02 21:58:11

1

我得到這個錯誤部署ASP.NET MVC 4站點Winhost。

答案是把它添加到每this link項目的web.config文件。

<connectionStrings> 
<remove name="LocalSqlServer" /> 
<add name="LocalSqlServer" connectionString="Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword" providerName="System.Data.SqlClient" /> 
</connectionStrings> 

您必須添加remove nameadd name

相關問題