本文介绍了SharePoint、WCF 和匿名访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SharePoint 上的 WCF 服务是否需要启用匿名访问?
我们有一个应用程序页面,它使用 Ajax.Net 调用服务,如果 Anon Access 关闭,那么我们会提示输入用户名和密码,如果它打开,则一切正常.
我们没有使用 WCF 客户端,它纯粹是由脚本管理器调用
<system.serviceModel><绑定><webHttpBinding><绑定名称="webHttpBinding_DataSources"maxBufferSize="5242880"maxReceivedMessageSize="5242880"/></webHttpBinding></绑定><行为><端点行为><行为name="ServiceAspNetAjaxBehavior"><启用WebScript/></行为></endpointBehaviors><服务行为><行为名称="服务行为"><服务元数据httpGetEnabled="真"httpGetUrl=""/><服务调试includeExceptionDetailInFaults="true"/></行为></serviceBehaviors></行为><服务托管环境aspNetCompatibilityEnabled="true"/><服务><服务名称="XXXXXXX.DataSources.Services.DataSourceHelper"行为配置=服务行为"><端点地址=""behaviorConfiguration="ServiceAspNetAjaxBehavior"绑定=webHttpBinding"bindingConfiguration="webHttpBinding_DataSources"contract="XXXXXXXX.DataSources.Services.IDataSourceHelper"/></服务></服务></system.serviceModel></配置>谢谢,菲尔
解决方案
我设法让它与以下一起工作
<system.serviceModel><绑定><webHttpBinding><绑定名称="webHttpBinding_DataSources"maxBufferSize="5242880"maxReceivedMessageSize="5242880" ><安全模式="TransportCredentialOnly"><传输 clientCredentialType="Ntlm"/></安全></binding></webHttpBinding></绑定><行为><端点行为><行为name="ServiceAspNetAjaxBehavior"><启用WebScript/></行为></endpointBehaviors><服务行为><行为名称="服务行为"><服务元数据httpGetEnabled="真"httpGetUrl=""/><服务调试includeExceptionDetailInFaults="true"/></行为></serviceBehaviors></行为><服务托管环境aspNetCompatibilityEnabled="true"/><服务><服务name="XXXXXXXXXX.DataSources.Services.DataSourceHelper"行为配置=服务行为"><端点地址=""behaviorConfiguration="ServiceAspNetAjaxBehavior"绑定=webHttpBinding"bindingConfiguration="webHttpBinding_DataSources"contract="XXXXXXXXXXX.DataSources.Services.IDataSourceHelper"/></服务></服务></system.serviceModel></配置>我执行了 IISReset,但不得不关闭并重新打开浏览器才能使其正常工作
此致,
菲尔
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
解决方案
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
这篇关于SharePoint、WCF 和匿名访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!