【问题标题】:wcf as windows service fails with errorwcf 作为 Windows 服务失败并出现错误
【发布时间】:2014-10-02 10:24:46
【问题描述】:

我编写了一个自托管的 WCF 服务。当我运行服务器和客户端时,客户端连接良好。我将服务器重写为 Windows 服务。现在,当我运行服务器和客户端时,服务器已启动,但客户端根据请求方法失败并出现错误

HTTP 请求未经客户端身份验证方案“协商”的授权。从服务器收到的身份验证标头是

Windows 服务注册为 LocalSystem。服务器配置:-

<system.serviceModel>
    <services>
      <service behaviorConfiguration="MyServiceTypeBehaviors" name="UCSService.UCSModule">
          <endpoint address="" binding="basicHttpBinding" contract="UCSService.IUCSModule">
          </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:9000/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding>
          <binding name="BasicHttpEndpointBinding" 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="Windows" proxyCredentialType="None"
                            realm="" />
                  <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
          </binding>
        </basicHttpBinding>
    </bindings>
  </system.serviceModel>  

客户端配置:-

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpEndpointBinding" closeTimeout="00:01:00"
                    openTimeout="00:00:30" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
                    textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
                    messageEncoding="Text">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://192.168.101.123:9000/" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpEndpointBinding" contract="UCSModuleClient.IUCSModule"
                name="BasicHttpBinding_UCSModule" />
        </client>
    </system.serviceModel>

据我了解,主要问题是服务器已成为服务,但我不知道如何解决问题。我该如何解决这个问题?

【问题讨论】:

标签: wcf


【解决方案1】:

【讨论】:

  • 我的帐户拥有管理员权限,包括管理员组。和谷歌搜索,我当然用过,但大多数决定是关于 NTLM 还是 IIS。
  • @VJS - 您的帐户可能拥有管理员权限,但运行服务的帐户是否拥有这些权限?
  • 我设置该服务是从管理员帐户运行的并且有同样的错误。我还尝试在客户端使用相同的数据填充 ClientCredentials.UserName 和 ClientCredentials.Windows.ClientCredential。
猜你喜欢
  • 2010-10-22
  • 2010-11-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-16
  • 2011-09-10
  • 1970-01-01
相关资源
最近更新 更多