问题
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