【问题标题】:Making WCF Northwind Sharp Architecture works使 WCF Northwind Sharp Architecture 工作
【发布时间】:2011-04-19 15:08:19
【问题描述】:

再次,作为 WCF、MVC 和 Sharp Architecture 的初学者,我可能会问一个愚蠢的问题,请耐心等待。

我终于能够让 Sharp Architecture 的 Northwind 示例发挥作用。

我可以使用互联网浏览器浏览服务 本地主机/NorthwindWcfServices/TerritoriesService.svc localhost/NorthwindWcfServices/TerritoriesService.svc?wsdl

我可以使用 WcfTestClient.exe 调用服务 GetTerritories

然后我使用 Fiddler 对其进行测试: 当我请求 GET 时,提琴手没问题: localhost/NorthwindWcfServices/TerritoriesService.svc?wsdl

当我开始请求时 localhost/NorthwindWcfServices/TerritoriesService.svc/GetTerritories

他们不断给我一个 400 Bad Request 错误。

我应该做些什么来让它工作吗?

我应该在提琴头请求中添加内容类型吗?还是应该在服务类中添加任何属性?

任何帮助将不胜感激。

谢谢

【问题讨论】:

    标签: wcf northwind sharp-architecture


    【解决方案1】:

    您必须使用 Web 配置文件配置服务,例如,如果您配置 WCF 以访问...您的服务配置应该如下所示

    <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="EndPBehavior">
          <webHttp/>
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="CastleTest.WCF.WCFService">
        <endpoint address="" binding="webHttpBinding"
                  contract="CastleTest.WCF.IWCFService"
                  behaviorConfiguration="EndPBehavior"/>
      </service>
    </services>
    

    试试看400是否报错

    【讨论】:

      猜你喜欢
      • 2012-09-04
      • 2012-09-04
      • 2012-02-14
      • 1970-01-01
      • 2011-04-12
      • 1970-01-01
      • 2011-08-21
      • 2012-11-26
      • 1970-01-01
      相关资源
      最近更新 更多