2014-02-27 27 views
0

已解決:發現問題,原來是我遺留的舊會員供應商系統中的一小部分代碼。只要它達到目的,它嘗試創建Membership Store,該存儲默認爲SQL Express實例。MVC 5項目部署 - SQLExpress數據庫文件自動創建錯誤

我收到的時候我我的MVC 5項目部署到Web服務器以下錯誤:在建立與SQL Server的連接發生

與網絡相關的或特定於實例的錯誤。服務器未找到或無法訪問。驗證實例名稱是否正確,並將SQL Server配置爲允許遠程連接。 (提供程序:SQL網絡接口,錯誤:26 - 錯誤定位服務器/實例指定)

描述:在執行當前Web請求期間發生未處理的異常。請查看堆棧跟蹤以獲取有關該錯誤的更多信息以及源代碼的位置。

的SQLExpress數據庫文件自動創建錯誤:

連接字符串指定使用應用程序的App_Data目錄中的數據庫位置本地SQL Server Express實例。提供程序試圖自動創建應用程序服務數據庫,因爲提供程序確定數據庫不存在。以下配置要求是成功檢查應用程序服務數據庫是否存在並自動創建應用程序服務數據庫所必需的:

我無法理解爲什麼它試圖創建SQL Express實例,我沒有在我的Web中指定。配置。我有一個預感(基於沒有具體的我必須添加),這可能與MVC 5 Identity的工作方式有關。下面是我的web.config:

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=301880 
    --> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <connectionStrings> 
     <add name="ManaIdentity" 
      providerName="System.Data.SqlClient" 
      connectionString="Server=DevelopmentMachine;    
          Database=ManaIdentity;    
          UID=someone;    
          PWD=somepassword;    
          Integrated Security=False;    
          MultipleActiveResultSets=True;" /> 
    </connectionStrings> 
    <appSettings> 
    <add key="webpages:Version" value="3.0.0.0" /> 
    <add key="webpages:Enabled" value="false" /> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    </appSettings> 
    <system.web> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" /> 
    <customErrors mode="Off"/> 
    </system.web> 
    <system.webServer> 
    <modules> 
     <remove name="FormsAuthenticationModule" /> 
    </modules> 
    <handlers> 
     <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 
     <remove name="OPTIONSVerbHandler" /> 
     <remove name="TRACEVerbHandler" /> 
     <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    </handlers> 
    </system.webServer> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> 
    <providers> 
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers> 
    </entityFramework> 
</configuration> 

這裏是我的web.release.config:

<?xml version="1.0"?> 

<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 --> 

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <!-- 
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an atrribute "name" that has a value of "MyDB". 
--> 
    <connectionStrings> 
     <clear /> 
     <add name="ManaIdentity" 
     providerName="System.Data.SqlClient" 
     connectionString="Server=DeploymentServer;    
          Database=ManaIdentity;    
          UID=someone;    
          PWD=somepassword;    
          Integrated Security=False;    
          MultipleActiveResultSets=True;" 
     xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> 
    </connectionStrings> 

    <system.web> 
    <compilation xdt:Transform="RemoveAttributes(debug)" /> 
    <!-- 
     In the example below, the "Replace" transform will replace the entire 
     <customErrors> section of your Web.config file. 
     Note that because there is only one customErrors section under the 
     <system.web> node, there is no need to use the "xdt:Locator" attribute. 

     <customErrors defaultRedirect="GenericError.htm" 
     mode="RemoteOnly" xdt:Transform="Replace"> 
     <error statusCode="500" redirect="InternalError.htm"/>--> 

    </system.web> 
</configuration> 

乾杯! 。

回答

1

好了,原來是一個位老成員資格提供代碼我會朝這是有問題的代碼:

變種用戶= @ Membership.GetUser();

相關問題