How to disable authentication schemes for WCF Data Services

前端 未结 1 1495
鱼传尺愫
鱼传尺愫 2021-02-06 09:44

When I deployed my WCF Data Services to production hosting I started to get the following error (or similar depending on which auth schemes are active):

I

相关标签:
1条回答
  • 2021-02-06 10:23

    Firstly it is possible to configurate Data Services on the web config file. The contract used by the DataService is called System.Data.Services.IRequestHandler.

    Here is what you can do in the web config file to configurate it.

    On the Service tag of the system.servicemodel element add the

    <service name="{you service type name including the namespace i.e. myapplication.myservice}">
        <endpoint address="" binding="webHttpBinding" contract="System.Data.Services.IRequestHandler">
        </endpoint>
    </service>
    

    Once you have that there you can start configuring all manners of thing using the standard WCF configuration elements.

    Secondly to enable or disabled authentication methods for a specific service in IIS you can do the following:

    On the snap in for IIS right click your service file (i.e. yourservice.svc) and click properties. Once in properties go to File Security Tab and chose the Edit button on the authentication and access control group box. after that it is just like setting up directory security in IIS.

    As a last suggestion as per any trouble shooting goes it is important to enable the wcf disgnostics while you configurate it using the xml configuration, being written in WCF, Data Service logging is as per wcf is rich and very informative.

    you can find out more about that on WCF Administration and Diagnostics

    I hope i was able to help you with your problem

    let me know how things goes.

    Regards

    Daniel Portella

    UPDATE:

    Hi Schneider

    To specify the authentication scheme in the xml read below

    For windows authentication as a example

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.serviceModel>
        <bindings>
          <webHttpBinding>
            <binding name="MyBindingName" >
              <security mode="Transport">
                <transport clientCredentialType="Windows" />
              </security>
            </binding>
          </webHttpBinding>
        </bindings>
        <services>
          <service name="{you service type name including the namespace i.e. myapplication.myservice}">
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="MyBindingName" contract="System.Data.Services.IRequestHandler">
            </endpoint>
          </service>
        </services>
      </system.serviceModel>
    </configuration>
    

    For other types of authentication please check the MSDN library for examples

    Common Scenarios for security

    0 讨论(0)
提交回复
热议问题