Visual Studio 2012, Publish (Web Deploy) - Code First Migrations not changing web.config

一笑奈何 提交于 2019-12-11 02:06:02

问题


I am using the publish tool from Visual Studio 2012 for the first time - locally as a test.

I have followed this tutorial: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-to-production

I can publish the site files fine, they work. But the code first migrations do not seem to work & no database is created. Even if I create the database manually, it doesn't change (for this test it is the same SQL Server instance that the main site is on - just with 'stage' added to the end of the name).

I also see no apparent attempt to perform any migrations in the output window of VS - just file & folder creation.

Am I missing something?

Update

According to this article some references should be added to the web config to enable code first migrations on the target server. They aren't being added to the local config - and the web.config on the target server isn't there (I think it's compiled for deployment so I can't see it?).

Should it be adding this to the local web.config first? Is this the problem? If so why isn't the publish wizard creating it and exactly what would I need to enter?

http://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&l=EN-US&k=k%28WebApplicationProjects.PackagePublishOverview%29;k%28TargetFrameworkMoniker-.NETFramework


回答1:


This problem went away when I deployed to a Windows Server 2008 server - rather than a local test site.

I did have to create the database and give permission to the appropriate IIS user - but after that it worked fine.



来源:https://stackoverflow.com/questions/16758894/visual-studio-2012-publish-web-deploy-code-first-migrations-not-changing-we

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