简体   繁体   中英

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

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

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM