簡體   English   中英

我的網絡應用程序在發布時找不到我的數據庫

[英]My web app doesn't find my database when published

我使用Visual Studio 2012創建了一個簡單的Web應用程序,使用MVC3並在Azure上發布。

當我在本地運行它時,一切正常。 但是當我發布時,一個頁面中有一個使用我創建的數據庫的表不會加載。 錯誤消息是巨大的,但是從這樣開始:

Exception Details: System.ComponentModel.Win32Exception: The system cannot find the   file specified

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.

Stack Trace: 


[Win32Exception (0x80004005): The system cannot find the file specified]

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558

然后繼續。

有三個表,一個是Visual Studio在其Web App示例上創建的Default。 我自己創建的另外兩個,在發布時都不起作用(在本地時運行完全正常)。

我假設問題出現在連接字符串上,如果我還有更多內容,請詢問:

<connectionStrings>
 <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Porta-comprimidos-20130503163319;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Porta-comprimidos-20130503163319.mdf" />
<add name="RemedioDBContext"
  connectionString="Data Source=|DataDirectory|\MeuPortaComprimidosDB.sdf"
  providerName="System.Data.SqlClient"/>
<add name="RemedioTempDBContext"
  connectionString=""
  providerName="System.Data.SqlClient"/>

誰能幫幫我嗎? 我研究了很多,不知道如何處理它(是的,我是新手)。

您的connection strings是將數據源設置為LocalDb設置,默認情況下,Windows Azure計算機上未安裝該數據源,您無法使用它(除非您安裝它)。

您必須將數據庫遷移到Windows Azure SQL並相應地更改connection string

有關更多信息,請訪問http://msdn.microsoft.com/en-us/library/windowsazure/ee730904.aspx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM