我正在尝试从我的代码中的 servicereferences.clientconfig 文件中读取端点,如下所示:
public BaseRepository()
{
_proxy = new MyServiceClient("BasicHttpBinding_IMyService");
this.binding = (BasicHttpBinding)_proxy.Endpoint.Binding;
this.endpoint = _proxy.Endpoint.Address;
}
这里“BasicHttpBinding_IMyService”是我在 Servicereferences.ClientConfig 中定义的端点的名称。
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxx/myservice.svc?wsdl"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="IMyserviceContract" name="BasicHttpBinding_IMyService" />
</client>
</system.serviceModel>
当我在本地运行它时它工作正常,但当我在服务器上部署它时它不起作用。我错过了什么吗?