我可以访问我的WCF服务并获得它的WSDL文件,但是不能访问它的“子目录”。当我在地址行中输入URL时,收到的错误如下所示。
14:42:45.509获取http://---.azurewebsites.net/MyService.svc/Ping HTTP/1.1400BAD请求105 42
接口和实现如下。
[OperationContract]
[WebGet(UriTemplate="Ping")]
String Ping();
public String Ping() { return "Pong"; }配置文件中的服务模型由以下部分组成。
行为
<behaviors>
<endpointBehaviors>
<behavior name="PingEndPointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name ="PingServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpsGetEnabled="true"/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true"
httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>绑定
<bindings>
<basicHttpBinding>
<binding name="PingBasicHttpBinding"/>
</basicHttpBinding>
</bindings>服务
<services>
<service name="MyNamespace.MyService"
behaviorConfiguration="PingServiceBehavior">
<endpoint name="PingEndpoint"
behaviorConfiguration="PingEndPointBehavior"
address="Ping"
bindingConfiguration="PingBasicHttpBinding"
contract="MyNamespace.IMyService"/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"/>
我遗漏了什么?
发布于 2013-06-18 08:23:03
我想您不能使用BasicHttpBinding输入URL并从WCF服务中获得响应。您应该使用webHttpBinding来完成上述工作。
https://stackoverflow.com/questions/17149121
复制相似问题