SharePoint, WCF and Anonymous Access

感情迁移 提交于 2019-12-11 09:56:02

问题


Does a WCF service on SharePoint require that Anonymous Access is enabled?

We have an application page which is calling the service using Ajax.Net, if Anon Access is off then we get prompted for the username and password, if it is on then all is well.

We are not using a WCF client, it is purely being called by the scriptmanager

<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding
          name="webHttpBinding_DataSources"
          maxBufferSize="5242880"
          maxReceivedMessageSize="5242880" />
      </webHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior
          name="ServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior
          name="ServiceBehavior">
          <serviceMetadata
            httpGetEnabled="true"
            httpGetUrl="" />
          <serviceDebug
            includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment
      aspNetCompatibilityEnabled="true"/>
    <services>
      <service
          name="XXXXXXXX.DataSources.Services.DataSourceHelper"
          behaviorConfiguration="ServiceBehavior">
        <endpoint
          address=""
          behaviorConfiguration="ServiceAspNetAjaxBehavior"
          binding="webHttpBinding"
          bindingConfiguration="webHttpBinding_DataSources"
          contract="XXXXXXXX.DataSources.Services.IDataSourceHelper" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

Thanks, Phill


回答1:


I managed to get it working with the following

<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding
          name="webHttpBinding_DataSources"
          maxBufferSize="5242880"
              maxReceivedMessageSize="5242880" >
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior
          name="ServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior
          name="ServiceBehavior">
          <serviceMetadata
            httpGetEnabled="true"
            httpGetUrl="" />
          <serviceDebug
            includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment
      aspNetCompatibilityEnabled="true"/>
    <services>
      <service
          name="XXXXXXXXXX.DataSources.Services.DataSourceHelper"
          behaviorConfiguration="ServiceBehavior">
        <endpoint
          address=""
          behaviorConfiguration="ServiceAspNetAjaxBehavior"
          binding="webHttpBinding"
          bindingConfiguration="webHttpBinding_DataSources"
          contract="XXXXXXXXXX.DataSources.Services.IDataSourceHelper" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

I did an IISReset and had to close and re-open my browser to get it working though

Best Regards,

Phill



来源:https://stackoverflow.com/questions/847414/sharepoint-wcf-and-anonymous-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!