I created a simple web app with Visual Studio 2012, using MVC3 and published it on Azure.
When I run it locally, everything works fine. But when I publish, one page where there is a table that use a db I created don't load. The error message is enormous, but start like this:
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
And go on and on.
There are three tables, one is the Default that is created by Visual Studio on its Web App sample. The other two I created on my own, and neither of them works when published (run perfectly fine when local).
I assuming the problem is on the Connection Strings, if there is anything more I should present here, please ask:
<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"/>
Can anyone, please, help me? I researched it a lot and have no idea how to handle it (yes, I am new into this).
Your connection strings
are settings the data source to LocalDb
which is not installed by default on Windows Azure machines and you cannot use it (unless you install it).
You have to migrate your database to Windows Azure SQL
and change your connection string
accordingly.
More info on http://msdn.microsoft.com/en-us/library/windowsazure/ee730904.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With