wcf as windows服务失败并出现错误

wcf as windows服务失败并出现错误,wcf,Wcf,我编写了一个自托管WCF服务。当我运行服务器和客户机时,客户机连接良好。我将服务器重写为Windows服务。现在,当我运行服务器和客户机时,服务器启动,但客户机在请求时失败,方法出错 HTTP请求未经客户端身份验证方案“协商”授权。从服务器接收的身份验证标头为 Windows服务已注册为LocalSystem。服务器配置:- <system.serviceModel> <services> <service behaviorConfigurati

我编写了一个自托管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>

据我所知,主要的问题是服务器已经变成了服务,但我不知道如何解决这个问题。我如何解决这个问题

你能用以下方式使用谷歌吗:


可能的解决方案:尝试使用用户管理员运行服务

我的帐户具有管理员权限,包括管理员组。谷歌搜索,当然我用过,但是关于NTLM或IIS的大多数决定。@VJS-你的帐户可能有管理员权限,但是运行该服务的帐户有管理员权限吗?我设置该服务是从管理员帐户运行的,并且有相同的错误。此外,我还尝试在客户端使用相同的数据填充ClientCredentials.UserName和ClientCredentials.Windows.ClientCredential。请遵循此链接,我希望它能对您有所帮助。我尝试了有关IIS的链接,但仍然存在错误。