Upload DBFile.mdf in App_Data to Azure

…衆ロ難τιáo~ 提交于 2019-12-06 07:50:47

The problem is that you're referencing a local SQL instance (.\SQLEXPRESS, the 'dot' stands for localhost). I'm assuming you are running SQL Server 2005/2008/2012 Express on your machine and that's why this works locally.

But when you deploy your application to Windows Azure, there's no SQL Server installed on that Web Role/Worker Role/Web Site (this would be a bad idea anyways because Web/Worker Roles are not persistent!).

What you'll need to do is sign up for a 'cloud database' like SQL Azure and use that. Or you could host it yourself in a Windows Azure Virtual Machine (which is IaaS, but this involves more work).

If you're building an MVC 3 application I would suggest you simply start with SQL Azure. Here is a tutorial: Running ASP.NET MVC 3 Applications on Azure (note that this tutorial contains screenshots of the old portal).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!