110,538
社区成员
发帖
与我相关
我的任务
分享
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAudit" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:7353/AuditFlow.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IAudit" contract="AuditFlowService.IAudit"
name="WSHttpBinding_IAudit" />
</client>
</system.serviceModel>
<service behaviorConfiguration="myServiceBehavior" name="U_ERP.WCFService.Service.AuditFlow">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wshttp"
contract="U_ERP.WCFService.Contract.ServiceContract.IAudit" />
</service>
3.创建了一个服务引用项目,在这个项目中通过添加服务引用来,引用自动加上了7573端口号。且会自动生成一个Client的相关类,可通过这个类直接访问上述服务的方法。生成的app.config如下,自动加上了端口号
<client>
<endpoint address="http://localhost:7353/AuditFlow.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IAudit" contract="AuditFlowService.IAudit"
name="WSHttpBinding_IAudit" />
</client>
上述过程在本机上编译都不存在问题,如果去别的机器部署,手动改步骤3的client然后编译也可以运行
但这显然很不方便。有什么办法可以在编译时读取步骤3的配置文件信息这样,部署的时候只要更改配置文件就可以了。
或者是不是还有更灵活的办法,感谢您的回复!