WCF新手问题

时间:2011-06-30 05:46:06

标签: .net wcf asp.net-mvc-3

尝试向我的MVC3项目添加一个非常简单的WCF服务。

做了以下事情......

  1. 项目根目录 - >档案 - >添加新项目 - > WCF服务
  2. 填写方法详情
  3. 方法的单元测试都正常工作
  4. 浏览WCF服务 - > http://baseUrl/myservicename.svc/mymethodname?myparameter=1234
  5. 目前返回400,我知道我必须遗漏一些简单但却看不到的东西?

2 个答案:

答案 0 :(得分:1)

你使用什么装订?

默认情况下,WCF服务是SOAP服务 - 您不能只浏览到SOAP端点......

请检查:

您可以将您的WCF服务更改为REST - 使用webHttpBinding - 或者您需要使用类似WCF Test Client tool的内容来获取服务。

答案 1 :(得分:0)

发现问题......

缺少一些web.config部分:

<service name="Fully.Qualified.ServiceName">
    <endpoint address="" behaviorConfiguration="Endpoint.Behavior.Name" 
    binding="webHttpBinding" contract="Fully.Qualified.ServiceInterface"></endpoint>
</service>

<endpointBehaviors>
    <behavior name="Endpoint.Behavior.Name">
        <enableWebScript />
    </behavior>
</endpointBehaviors>

+1给Marc,认为他在正确的轨道上谢谢:)

相关问题