更新时间:2023-11-22 11:31:28
您的WCF服务是一个库(DLL)吗?我问是因为您发布的配置文件中包含以下行:
Is your WCF service a library (DLL)? I ask because of the following line in the config file you posted:
< !!-部署服务库项目时,必须将配置文件的内容添加到主机的app.config文件.System.Configuration不支持库的配置文件.->
如果您的服务是DLL,则需要在主机的配置文件中发布< system.serviceModel>
部分.对于IIS,该文件为web.config文件;对于Windows服务或自托管服务,它将是app.config文件.如上面的注释行所述,服务库不使用它们自己的配置文件,而是使用主机的配置文件.
If your service is a DLL, then you'll need to post the <system.serviceModel>
section in the host's config file. For IIS, that would be the web.config file; for a Windows Service or self-hosted service, it would be the app.config file. As the commented line above says, service libraries do not use their own config files, they utilize the host's config file.