【问题标题】:WCF Service - Failed to Invoke service - JSONWCF 服务 - 无法调用服务 - JSON
【发布时间】:2015-06-12 20:15:09
【问题描述】:

调用服务失败。可能原因:服务离线 或无法访问;客户端配置不匹配 代理;现有代理无效。请参阅堆栈跟踪 更多详情。您可以尝试通过启动新代理来恢复,恢复 到默认配置,或者刷新服务。

The Address property on ChannelFactory.Endpoint was null.  The ChannelFactory's Endpoint must have a valid Address specified.
   at System.ServiceModel.ChannelFactory.CreateEndpointAddress(ServiceEndpoint endpoint)
   at System.ServiceModel.ChannelFactory`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at InstantBankVerificationPostBackClient.PostBack(String data)

Web.Config:

<services>
    <service behaviorConfiguration="DebugJSonBehavior" name="IBVWebService.InstantBankVerificationPostBack">
        <endpoint address="http://localhost:64337/InstantBankVerificationPostBack.svc" 
            binding="webHttpBinding"
            contract="IBVWebService.IInstantBankVerificationPostBack"
            behaviorConfiguration="webBehavior">
            <identity>
              <dns value="localhost" />
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
</services>

<behaviors>
    <endpointBehaviors>
        <behavior name="webBehavior">
            <webHttp/>
        </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
        <behavior name="DebugJSonBehavior">
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
        </behavior>
    </serviceBehaviors>
</behaviors>

界面:

[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
RequestFormat = WebMessageFormat.Json)]
void PostBack(string data);

【问题讨论】:

  • 你能发布你的电话代码吗?

标签: c# json wcf


【解决方案1】:

所以我相信我收到此错误是因为使用了 WCF 客户端工具,该工具目前不适用于使用 json 的 wcf。我试着用小提琴,我得到了一些不同的 HTTP/1.1 400 错误请求。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多