.net 4.0
我有两个 Web 项目使用自己的web.config
文件并使用相同的端点来调用相同的 WCF Web 服务。
两者都使用具有app.config
文件的通用项目(dll)。我想将端点信息移动到该配置文件中 - 这可能吗?我想要端点信息
<client>
<endpoint/>
<client/>
由两个 Web 应用程序从共同的地方共享?
Web.config
此处省略文件绑定信息
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings/>
<client configSource="client.config">
<system.serviceModel/>
</configuration>
client.config
公共项目中的文件
<client>
<endpoint
name="endpoint1"
address="http://localhost/ServiceModelSamples/service.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IHello"
behaviorConfiguration="IHello_Behavior"
contract="IHello"/ >
为错字道歉 我更改了两件事 1. client.config 有一个元素将其删除。2. 在项目的构建属性中添加 COPY "$(TargetDir)*.config" "$(ProjectDir)"
只需在 web.config (configSource) 和 client.config 中提及 VStudio 大喊设计时间但运行良好?