2013-06-04 26 views
5

Tôi đã tạo một ứng dụng web đơn giản với Visual Studio 2012, sử dụng MVC3 và xuất bản nó trên Azure.Ứng dụng web của tôi không tìm thấy cơ sở dữ liệu của tôi khi xuất bản

Khi tôi chạy nội bộ, mọi thứ hoạt động tốt. Nhưng khi tôi xuất bản, một trang nơi có một bảng sử dụng db mà tôi tạo không tải. Thông báo lỗi rất lớn, nhưng bắt đầu như thế này:

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 

Và cứ tiếp tục.

Có ba bảng, một là Mặc định được tạo bởi Visual Studio trên mẫu Ứng dụng web của nó. Hai thứ khác tôi tự tạo ra, và cả hai đều không hoạt động khi được xuất bản (chạy hoàn toàn tốt khi địa phương).

Tôi giả sử vấn đề là trên Strings Connection, nếu có bất cứ điều gì hơn tôi nên trình bày ở đây, xin vui lòng đặt câu hỏi:

<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"/> 

thể bất cứ ai, xin vui lòng, giúp tôi? Tôi đã nghiên cứu rất nhiều và không có ý tưởng làm thế nào để xử lý nó (có, tôi mới vào điều này).

Trả lời

3

connection strings là cài đặt nguồn dữ liệu thành LocalDb không được cài đặt mặc định trên máy Windows Azure và bạn không thể sử dụng nó (trừ khi bạn cài đặt).

Bạn phải di chuyển cơ sở dữ liệu của mình sang Windows Azure SQL và thay đổi connection string tương ứng. Thông tin

Thông tin thêm về http://msdn.microsoft.com/en-us/library/windowsazure/ee730904.aspx

+0

Nhưng "DefaultConnection", được sử dụng để tài khoản (thành viên, vai trò, vv), hoạt động tốt. Nếu đó là vấn đề, không phải db này cũng bị phá vỡ? – soneca

+0

Có, nó cũng không hoạt động. bạn có chắc đây là 'chuỗi kết nối' đang được nhà cung cấp' thành viên' sử dụng không? – haim770

+0

Có, connectionStringName = "DefaultConnection" – soneca

Các vấn đề liên quan