LocalDB works fine in Visual Studio IIS, fails whe

2019-07-27 12:03发布

I have a code first localdb database in my MVC 4 project and if I run the application in Visual Studio 2012 it connects fine and everything works. When I publish to my full IIS and access the site the database cannot connect and I get :

"the specified localdb instance does not exist"

I've had other problems, it seems localdb is a nightmare to deploy! I followed all the advice here also: http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

I'm still having no luck, why does it work perfectly in VS IIS Express and not 'real' IIS?

Thanks

1条回答
手持菜刀,她持情操
2楼-- · 2019-07-27 12:25

I would recommend installing and developing against a full instance of SQL server to avoid this problem when deploying to IIS locally.

LocalDB is a very small subset (around 30 MB) of SQL server so you can develop against it with out installing the entire server application. This works very nicely along with IIS Express during development. For deployment, your database for that environment should be hosted an a full fledged SQL Server Express/Developer/Standard/etc and your connection string should be changed to reflect

As you pointed out the post might shed some light on a workaround but only for development using a Local IIS Server (not IIS Express) with LocalDB.

查看更多
登录 后发表回答