开发者

WCF Restful Service .NET 4 IIS 7.5 Issues (The message with Action '' cannot be processed)

I have a wcf restful service up and running. I can issue Get/Post with no issues if I start a webservice using WebServiceHost. I tried moving the wcf service to IIS 7.5 on my local box and I can't seem to get it going.

I keep getting the following error anything I try to call anything from from the wcf service: (http://wp9dbytr1k1:8081/service.svc/AnythingHereForGETorPUT). I've tried in virtual directory/Appliances and I get the same issue.

The message with Action '' cannot be processed at the receiver, due to a     ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract  mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

if I call the svc file directly (http://wp9dbytr1k1:8081/service.svc), its happy and tells me

"You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://wp9dbytr1k1:8081/FUU/service.svc?wsdl"

The strack trace from Trace viewer hasn't help: Sorry have to add a link, not allowed to post images yet. (ImageLink)

Here's my web.config

  <system.serviceModel>
    <bindings>
      <mexHttpsBinding>
        <binding name="NewBinding0" />
      </mexHttpsBinding>
      <webHttpBinding>
        <binding name="WebBinding">
          <readerQuotas maxDepth="524288" maxStringContentLength="524288"
            maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="StoredProcBehaviors" name="StoredProcService.DataRetreivalService">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="WebBinding"
          contract="StoredProcService.IDataRetreivalService">
          <identity>
            <dns value="locahost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
          contract="StoredProcService.IDataRetreivalService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://WP9DBYTR1K1:8081/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="StoredProcBehaviors">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </开发者_如何学PythonserviceBehaviors>
    </behaviors>

For obvious reasons, this feels like IIS setup since it works with WebServiceHost. I've googled the errors/tutorials on how to set this up and everything seems good to me.

Any suggestions?

Thanks


To create a REST endpoint in WCF, you need, in addition to using the WebHttpBinding, to have an endpoint behavior with on it.

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="StoredProcBehaviors" name="StoredProcService.DataRetreivalService">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="WebBinding" behaviorConfiguration="REST"
          contract="StoredProcService.IDataRetreivalService">
          <identity>
            <dns value="locahost" />
          </identity>
        </endpoint>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="REST">
          <webHttp/>
        </behavior>
      <endpointBehaviors>
    </behaviors>
  </system.serviceModel>

Another option is to use the WebServiceHostFactory in the .svc file, which works like the WebServiceHost. In this case you don't even need the system.serviceModel section in web.config.

<% @ServiceHost Service="StoredProcService.DataRetreivalService" Factory="System.ServiceModel.Activation.WebServiceHostFactory" Language="C#" debug="true" %>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜