WCF newbie question
Trying to add a very simple WCF service to my MVC3 project.
Have done the following...
- Project root -> File -> Add new item -> WCF Service
- Filled out method details
- Unit tests for methods all working correctly
- 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 :)
精彩评论