【发布时间】:2019-06-03 07:41:49
【问题描述】:
我们有一个设置,包括开发测试和生产环境。所以当开发和测试完成时,每台服务器都有相同的WebServices。 这是我第一次这样做,但在开发中。我使用 Visual Studio (2017) 的“添加服务引用”功能编写了一个 WebService 和一个 C# 客户端。所以我有一个这样的 app.config 文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BizTalkInterfaceServiceSoapBinding">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxx.xxx.xxx.xxx:xxxxx/and/so/on"
binding="basicHttpBinding" bindingConfiguration="BizTalkInterfaceServiceSoapBinding"
contract="ServiceReference.BizTalkInterface" name="BizTalkInterfacePort" />
</client>
</system.serviceModel>
</configuration>
还有一个 Connected Services->ServiceReference 结构,带有 .wsdl、configuration.svcinfo、configuration91.svcinfo 和 Reference.svcmap 文件。不知道显示这些文件的内容有没有意义?
我这样初始化客户端:
protected BizTalkInterfaceClient client;
protected ServiceBase()
{
client = new BizTalkInterfaceClient("BizTalkInterfacePort");
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
client.ClientCredentials.UserName.UserName = "xxx@xxxdomain";
client.ClientCredentials.UserName.Password = "xxxxxx";
}
无论如何 - 这一切都很好,并且工作正常。
如果您还没有弄清楚 :-),我想定义另外两个命名端点,但我不确定如何去做。有没有类似向导的方法,还是我必须复制/过去 app.config 和配置文件中的端点?
任何帮助将不胜感激。提前非常感谢。
【问题讨论】: