开发者

WCF Endpoint Address not working

Can someone please tell me what I'm doing wrong below? I have been fighting with this for hours and believe that I have it right, but I have to be missing something. Basically for every service I have I would like to have to addresses. These services are to be hosted in IIS. I have been testing with IIS Express. My expectation is that I would access the services at /AuthService.svc/soap and /AuthService.svc/json, but that doesn't seem to be working. Below is the config I'm using.

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="jsonBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="SecureBinding" allowCookies="true" maxReceivedMessageSize="67108864">
          <readerQuotas maxArrayLength="67108864"/>
          <security mode="Transport"/>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="SecureBinding" allowCookies="true" maxReceivedMessageSize="67108864">
          <readerQuotas maxArrayLength="67108864"/>
          <security mode="Transport"/>
        </binding>
      </webHttpBinding>
      </bindings>
      <services>
        <service name="AuthService" behaviorConfiguration="DefaultServiceBehavior">
          <endpoint address="soap"
                  binding="basicHttpBinding"
                  bindingConfiguration="SecureBinding" 
                  contract="FormsAuthenticatingServices.Interfaces.IAuthService" />
          <endpoint address="json"
                  binding="webHttpBinding"
                  bindingConfiguration="SecureBinding"
                  behaviorConfiguration="jsonBehavior"
                  contract="FormsAuthenticatingServices.Interfaces.IAuthService" />
        </service>
        <service name="DataService" behaviorConfiguration="DefaultServiceBehavior">
          <endpoint address="soap"
                  binding="basicHttpBinding"
                  bindingConfiguration="SecureBinding"
                  contract="FormsAuthenticatingServices.Interfaces.IDataService" />
          <endpoint address="json"
                  binding="webHttpBinding"
                  bindingConfiguration="SecureBi开发者_JS百科nding"
                  behaviorConfiguration="jsonBehavior"
                  contract="FormsAuthenticatingServices.Interfaces.IDataService" />
        </service>
      </services>
    </system.serviceModel>


You should get the SOAP based metadata at /authservice.svc?wsdl and the REST based operations starting from the URI /authservice.svc/json

You will not see anything in a browser by hitting /authservice.svc/soap as SOAP assumes XML messages will be POSTed to the service whereas the browser is performing a GET. To use the SOAP service create a client project and generate a proxy using Add Service Reference pointing at the WSDL


In addition to Richard's answer, make sure the name attribute on the <service> element is the fully qualified name of the service class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜