您的 WCF 服务很可能具有定义服务主机绑定、行为和端点元素的配置文件。因此,URL 应该是服务基地址和 UriTemplate 的组合。以下配置文件片段提供了来自我们的 wcf https 休息服务之一的参考示例:
<bindings>
<webHttpBinding>
<binding name="RestBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
…</p>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceCredentials>
…
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
…</p>
<service name="TestRest">
<endpoint behaviorConfiguration="RestBehavior" binding="webHttpBinding"
bindingConfiguration="RestBinding" name="RestServiceEndpoint"
contract="Test.Rest.Interface" />
<host>
<baseAddresses>
<add baseAddress="http://domain.name.here:18100/" />
</baseAddresses>
</host>
</service>
因此,URL 将是:
http ://domain.name.here:18100/JsonData
问候,