我正在编写一个非常基本的SharePoint WebService。 我测试了2010年的小图书馆,它每次都很好。

问题附带了MOSS 2007服务器,其中一个图书馆非常大。 我正在使用.NET 3.5,只需在三行代码以下,随机地获得错误,请求通道超时在等待回复时00:00:59之后。如果我增加超时,那么仍然随机地获得错误, 底层连接已关闭:连接已意外关闭。

ListsSoapClient client = new ListsSoapClient();
        client.ClientCredentials.Windows.ClientCredential 
= System.Net.CredentialCache.DefaultNetworkCredentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel 
=   System.Security.Principal.TokenImpersonationLevel.Impersonation;
XmlElement listCollection = client.GetListCollection();
.

我没有为什么随意地输出和破坏,服务器没有问题。我有U2U CAML Builder并使用它我可以不停地执行查询并立即获取结果。

我认为我的app.config或我需要在客户端设置的东西有问题。

我的app.config有下面的设置,

        <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">
        <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm"/>
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
        </security>
        <readerQuotas maxDepth="32" maxStringContentLength="8192" 
        maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />                 
        </binding>
.

  <client>
    <endpoint address="http://ap/AP/_vti_bin/Lists.asmx" binding="basicHttpBinding"
      bindingConfiguration="ListsSoap" contract="SharePointListWebService.ListsSoap"
      name="ListsSoap" />
    <endpoint address="http://ap/AP/_vti_bin/Copy.asmx" binding="basicHttpBinding"
      bindingConfiguration="CopySoap" contract="SharePointCopyWebService.CopySoap"
      name="CopySoap" />
  </client>
.

当我省一段时间到10分钟时,我会收到以下错误。并再次,它<强烈>随机

   Unhandled Exception: System.ServiceModel.CommunicationException: The underlying
   connection was closed: A connection that was expected to be kept alive was close
   d by the server. ---> System.Net.WebException: The underlying connection was clo
   sed: A connection that was expected to be kept alive was closed by the server.
      at System.Net.HttpWebRequest.GetResponse()
      at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
   nnelRequest.WaitForReply(TimeSpan timeout)
      --- End of inner exception stack trace ---

   Server stack trace:
      at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebExc
   eption(WebException webException, HttpWebRequest request, HttpAbortReason abortR
          eason)
      at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
   nnelRequest.WaitForReply(TimeSpan timeout)
      at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeS
   pan timeout)
      at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message messag
   e, TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannel.Call(String action,               Boolean        on       
   eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim
   eout)
      at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
   eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
      at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall
   Message methodCall, ProxyOperationRuntime operation)
      at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

   Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
   Msg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
   ta, Int32 type)
      at FetchInvoicesFromSharePointForMaximo.SharePointListWebService.ListsSoap.Ge
   tListCollection(GetListCollectionRequest request)
      at FetchInvoicesFromSharePointForMaximo.SharePointListWebService.ListsSoapCli
   ent.FetchInvoicesFromSharePointForMaximo.SharePointListWebService.ListsSoap.GetL
   istCollection(GetListCollectionRequest request) in C:\FetchInvoicesFromSharePoin
   tForMaximo\FetchInvoicesFromSharePointForMaximo\Service References\SharePointLis
   tWebService\Reference.cs:line 2267
      at FetchInvoicesFromSharePointForMaximo.SharePointListWebService.ListsSoapCli
   ent.GetListCollection() in C:\FetchInvoicesFromSharePointForMaximo\FetchInvoices
   FromSharePointForMaximo\Service References\SharePointListWebService\Reference.cs
   :line 2273
      at FetchInvoicesFromSharePointForMaximo.Program.Main(String[] args) in C:\Fet
   chInvoicesFromSharePointForMaximo\FetchInvoicesFromSharePointForMaximo\Program.c
   s:line 32
.

有帮助吗?

解决方案 2

我解决问题,但我不确定hwy发生这种情况可能是一些专家可以发表评论。

解决方案,而不是作为服务参考添加,我添加为Web参考,并且它确实了它。

我的假设是下面,

  1. 苔藓2007不喜欢由服务参考创建的代理客户端
  2. 在我的网络中,我们在不同域中有两个应用程序,虽然我在服务引用中使用完全限定名称,但这不应该导致

    感谢

其他提示

更改以下内容:

closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00"
.

到:

closeTimeout="00:10:00" openTimeout="00:10:00"
        receiveTimeout="00:10:00" sendTimeout="00:10:00"
.

许可以下: CC-BY-SA归因
scroll top