开发者

Connecting to Sql Azure with Entity Framework "Code First" ctp 5

Is it possible to connect to Sql Azure with Entity Framework "Code First" ctp 5? I keep getting a:

"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible." ..message.

I know my connection string is corre开发者_如何学JAVAct because I can connect to the database with server explorer in Visual Studio.

I tried connecting to an existing database and creating a database first, both return the same message.

Also, everything works if I use a local database (sqlexpress).


I was passing the name of the connection string into the constructor instead of the connection string name. If you do this, I think it automatically creates a new sqlExpress connection. This may be because I placed the connection strings in the web.debug.config and web.live.config and it couldn't resolve them.


SQL Azure does not support (or to be more precise give access to) all of the system stored procs and other commands that regular SQL server or SQL Express support and open up to. You will find SQL Azure somewhat constraining when it comes time to managing it.

What you want to do is create your database locally and then migrate it over to SQL Azure using either RedGate's SQL Compare beta for version 9.0 found at: http://www.red-gate.com/Azure or use SQL Azure migration wizard found at: http://sqlazuremw.codeplex.com/


I'm having the same problem, not connecting to azure though. This question came up in my search. I have code first working fine with my local SQLExpress instance but when I try and connect remotely to another server running SQL2008R2, I get the same error. I can however, in the same code I'm using CF CTP5, connect with the same ConnectionString using straight ADO.NET.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜