【发布时间】:2010-03-08 03:52:13
【问题描述】:
Sharepoint 设置为使用 NTLM 身份验证。
当我引用 http://myserver/Sites/Ops/_vti_bin/Lists.asmx?WSDL 作为 Web 引用时,我可以调用方法并获得有效响应。
当我引用与服务引用相同的 url 时,服务器在调用方法时会抛出异常。
我的帐户是 Sharepoint Farm 的管理员。
这是服务参考的 app.config(主要是自动生成的):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myserver/Sites/Ops/_vti_bin/Lists.asmx"
binding="basicHttpBinding" bindingConfiguration="ListsSoap"
contract="SharepointLists.ListsSoap" name="ListsSoap" />
</client>
</system.serviceModel>
</configuration>
可悲的是,异常提供的唯一信息是:
“引发了 'Microsoft.SharePoint.SoapServer.SoapServerException' 类型的异常。”
没有其他细节。
我使用的代码是:
public ListClass()
{
_Client = new SharepointLists.ListsSoapClient();
}
public System.Xml.Linq.XElement GetTaskList()
{
return _Client.GetList("Tasks");
}
有什么想法吗?我想使用服务参考而不是网络参考。
更新:
我尝试了 Rob 的建议并得到了这个错误:
HTTP GET Error URI: http://myserver/Sites/Ops/_vti_bin/Lists.asmx The document at the url http://myserver/Sites/Ops/_vti_bin/Lists.asmx未被识别为已知的文档类型。 来自每种已知类型的错误消息可能会帮助您解决问题: - 来自“http://myserver/Sites/Ops/_vti_bin/Lists.asmx”的报告是“文档 格式不被识别(内容类型是'text/html; 字符集=utf-8')。'。 - 来自“DISCO 文档”的报告是“下载时出错 'http://myserver/_vti_bin/Lists.asmx?disco'.'。 - 请求失败,HTTP 状态为 404:未找到。 - 来自“WSDL 文档”的报告是“无法识别文档格式 (缺点 帐篷类型是'text/html;字符集=utf-8')。'。 - 来自“XML Schema”的报告是“无法识别文档格式( 内容 t 类型是 'text/html; charset=utf-8').'.
【问题讨论】:
标签: .net sharepoint asmx sharepoint-2010 service-reference