开发者

WCF newbie question

Trying to add a very simple WCF service to my MVC3 project.

Have done the following...

  1. Project root -> File -> Add new item -> WCF Service
  2. Filled out method details
  3. Unit tests for methods all working correctly
  4. Browse WCF service -> http://baseUrl/开发者_开发百科myservicename.svc/mymethodname?myparameter=1234

Currently returning 400's, I know I must be missing something simple but can't see what?


What binding do you use??

By default, a WCF service is a SOAP service - and you cannot just browse to a SOAP endpoint...

Please check:

  • can you at least browse to http://baseUrl/myservicename.svc ??
  • what about http://baseUrl/myservicename.svc?wsdl ??

You could change your WCF service to REST - use the webHttpBinding - or you need to use something like the WCF Test Client tool to get at the service.


Found the problem...

Was missing a few web.config sections:

<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 to Marc, think he was on the right track thanks :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜