【发布时间】:2016-04-03 15:58:44
【问题描述】:
该服务确实可以正常工作,但由于某种原因,我无法使用 wcftestclient.exe 从本地 PC 到服务器 - 我想使用 wcftestclient.exe 调用方法。
它都是公司内部的、自托管的(在 Windows 服务中运行,没有 iis)。 framework 4. Basichttpbinding,不需要任何安全的东西。
这是我的 servicemodelconfig ...
<system.serviceModel>
<services>
<service name="myService">
<endpoint
address="http://servername:8001/myService"
binding="basicHttpBinding"
contract="IMyService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name ="MyDefaultBehaviour">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://servername:8001/myService/mex" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="1" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我明白了……
错误:无法从中获取元数据 如果这是您有权访问的 Windows (R) Communication Foundation 服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅位于 http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange 错误 URI 的 MSDN 文档:
元数据包含无法解析的引用:'。内容类型应用程序/soap+xml;服务不支持 charset=utf-8
客户端和服务绑定可能不匹配。远程服务器返回错误:(415)无法处理消息,因为内容类型'application/soap+xml; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'..HTTP GET 错误 URI:
下载“http://”时出错
请求失败,HTTP 状态 400:错误请求。
我已经把上面的服务器名删掉了,有很多空白,但希望信息足够清楚。
我确实尝试过添加额外的端点...
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
但是这样一来,windows 服务就无法启动了。
谢谢
----- 稍后添加 --- 也尝试过,但再次,服务没有启动
<system.serviceModel>
<services>
<service name="myService" behaviorConfiguration="MyDefaultBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://myServer:8001/myService" />
</baseAddresses>
</host>
<endpoint
address=""
binding="basicHttpBinding"
contract="Contracts.ImyService" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetaDataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name ="MyDefaultBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="1" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
【问题讨论】: