无法连接到 https://service。TCP错误码10060:连接尝试失败,因为连接的一方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应10.30.82.99:443。
我有2个配置文件如下:
服务器:
<system.serviceModel>
<services>
<service name="Olap.Service.OlapService" behaviorConfiguration="sb">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="" behaviorConfiguration="end" binding="basicHttpBinding" bindingConfiguration="webBind" contract="Olap.Service.IOlapService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="sb">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="end">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="webBind">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
客户:
<system.serviceModel>
<client>
<endpoint address="https://service" binding="basicHttpBinding"
bindingConfiguration="webBind" contract="Olap.Service.OlapService.IOlapService"
name="ServiceWcf" />
</client>
<bindings>
<basicHttpBinding>
<binding name="webBind">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
我添加了一个服务引用,并在尝试调用我创建的 OlapServiceClient 对象上的方法时(new OlapServiceClient("ServiceWcf") 我得到了异常。我一直在查看其他类似的问题,但没有任何效果。我从其他人那里推测我在服务器上的绑定设置必须与客户端相同。如果我将链接更改为 http,它也不起作用,然后收到异常消息“提供的 URI 方案'http'无效;预期'https '。参数名称:通过“我在这里也看到了很多关于但无法修复自己的页面。内部异常说“无法连接到远程服务器”。干杯