简体   繁体   English

如何将带有实体框架的WCF服务部署到IIS?

[英]How to deploy WCF service with Entity Framework to IIS?

I currently copy web.config, SVC file and a bin folder with all the compiled code. 我目前将所有已编译的代码复制到web.config,SVC文件和bin文件夹中。 This is sufficient for non-DB operations to work. 这足以使非DB操作正常工作。 However, I get errors whenever I call any operation which has EF entities. 但是,每当我调用具有EF实体的任何操作时,都会出错。

The web.config file contains a valid connection string. web.config文件包含有效的连接字符串。 How should I deploy the edmx file? 我应该如何部署edmx文件?

Also, instead of this manual deployment, is there an alternate way to build a deployment package that will take care of DB upgrades as well if needed? 另外,除了此手动部署以外,还有其他替代方法来构建部署包,该部署包将在需要时也负责数据库升级吗?

I tried the "Publish" option but that is not very intuitive. 我尝试了“发布”选项,但这不是很直观。

I am using .Net 4.0, VS2010, IIS7.5, SQLServerExpress 2008R2. 我正在使用.Net 4.0,VS2010,IIS7.5,SQLServerExpress 2008R2。

Not sure if you are know MSBuild, if you know MSBuild in deep, you can write MSBUILD script to accomplish all the tasks. 不知道您是否了解MSBuild,如果您很了解MSBuild,则可以编写MSBUILD脚本来完成所有任务。

1 - For Entity framework. 1-对于实体框架。 On deployment server, you need to install Entity framework 4 or the version that you are using. 在部署服务器上,您需要安装Entity Framework 4或使用的版本。

2 - DB upgrade is a strategy. 2-数据库升级是一种策略。 So you need to think about this. 因此,您需要考虑一下。 Better create a DB project in Visual studio and it will simplify some of the stuffs. 更好地在Visual Studio中创建一个数据库项目,它将简化一些内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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