简体   繁体   English

在Windows服务中托管WCF服务

[英]Hosting WCF service in Windows service

There is a client in the form of an ASP.NET MVC application, there is a WCF service, requests to the WCF service are sent from the client, the service itself manipulates database data through the Entity Framework. 有一个以ASP.NET MVC应用程序形式存在的客户端,有一个WCF服务,从该客户端发送对WCF服务的请求,该服务本身通过实体框架操纵数据库数据。 Everything works locally in the Visual Studio development environment via IIS Express, but when I deploy this service on a Windows service, an error appears 一切都可以通过IIS Express在Visual Studio开发环境中本地工作,但是当我在Windows服务上部署此服务时,会出现错误

"The underlying provider failed on Open." “底层提供程序在Open上失败。”

DB connection string in app.config app.config中的数据库连接字符串

<connectionStrings>
    <add name="AddressBookEntities" 
         connectionString="metadata=res://*/ContactModel.csdl|res://*/ContactModel.ssdl|res://*/ContactModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\AddressBook.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
         providerName="System.Data.EntityClient" />
</connectionStrings>

我建议您使用SQL Server Express,附加文件名需要特定的用户上下文

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

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