是否可以调用SharePoint中的Windows服务中托管的WCF服务?

时间:2010-02-02 11:02:07

标签: wcf sharepoint windows-services wss wcf-binding

我有一个WCF服务托管在同一服务器中的Windows服务中,我有苔藓。

WCF可以很好地从Console应用程序调用它,但如果我从Sharepoint中的页面调用它,它会抛出超时异常。

我在webconfig中添加了以下配置:

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IReplication" closeTimeout="00:10:00"
            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8000/Replication/service"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IReplication"
          contract="ServiceReference1.IReplication" name="WSHttpBinding_IReplication">
        <identity>
          <servicePrincipalName value="host/mypc-f1d530f" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

有关正在发生的事情的任何想法? 你有没有人成功地做到了这一点?我在网上找不到任何样本。

1 个答案:

答案 0 :(得分:0)

您应该尝试禁用环回检查,方法是在DWORD下创建一个名为DisableLoopbackCheck的{​​{1}},并为其设置值HKLM\System\CurrentControlSet\Control\Lsa。不要忘记稍后重新启动计算机。