WCF:我继续收到错误“调用者未通过服务进行身份验证。”

时间:2022-10-24 20:27:53

I Keep getting this error while performing test with WCF Test Client :

我在使用WCF测试客户端执行测试时遇到此错误:

The caller was not authenticated by the service.

呼叫者未通过该服务进行身份验证。

I tried to set the security mode to none on both side but the error still persisted

我试图将安全模式设置为无,但错误仍然存​​在

I can not use basicHttpBinding because from what I know it's in .Net 4.5

我不能使用basicHttpBinding,因为据我所知,它位于.Net 4.5中

I've spent hours for this problem but still got no luck even though I've come through some similar topics on SOF also, but they didn't help!

我已经花了好几个小时来解决这个问题但是仍然没有运气,即使我在SOF上也遇到过类似的话题,但他们没有帮助!

Web.config :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="ota2010AEndpoint" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
                    <readerQuotas maxDepth="32"/>
                    <reliableSession ordered="true"/>
                    <security mode="None" />
                </binding>
            </wsHttpBinding>
        </bindings>

        <services>
            <service behaviorConfiguration="CalculatorServiceBehavior" name="GWork_Service.Service1">
                <endpoint address="" binding="wsHttpBinding" contract="GWork_Service.IService1" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                    <add baseAddress="http://xxx:8000/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="CalculatorServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>

Client's app config :

客户的应用配置:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IService1">
          <security mode="None" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://xxx:8000/" binding="wsHttpBinding"
          bindingConfiguration="WSHttpBinding_IService1" contract="GWork_MER.ServiceReference1.IService1"
          name="WSHttpBinding_IService1" />
    </client>
  </system.serviceModel>
</configuration>

I'm sorry, I have to add more letters here so I can pass SOF's rule about having too many code in the question ..siaasd asjasjd kasjg kash jasdkus kasdashdsakdasd jasdj ldasdj asd lasd kk adjsad lasld ads kasd lald h3riew askk asdjasdj asdj asdj asd asdj asdj asdj adjsadjasd jasdj asdj adsj adsj ajdasjdasd jadj jsksk jdd asdasd wow that's still not enought i have to add more here

对不起,我必须在这里添加更多信件,这样我才能通过SOF关于在问题中包含太多代码的规则..siaasd asjasjd kasjg kash jasdkus kasdashdsakdasd jasdj ldasdj asd lasd kk adjsad lasld ads kasd lald h3riew askk asdjasdj asdj asdj asd asdj asdj asdj adjsadjasd jasdj asdj adsj adsj ajdasjdasd jadj jsksk jdd asdasd哇哇仍然没有想到我必须在这里添加更多

1 个解决方案

#1


0  

I can not use basicHttpBinding because from what I know it's in .Net 4.5

我不能使用basicHttpBinding,因为据我所知,它位于.Net 4.5中

It's not true.

这不是真的。

To solve this problem check if your dates on client and server are synchronized. Just set the same hour on server and client machine.

要解决此问题,请检查客户端和服务器上的日期是否已同步。只需在服务器和客户端计算机上设置相同的小时。

#1


0  

I can not use basicHttpBinding because from what I know it's in .Net 4.5

我不能使用basicHttpBinding,因为据我所知,它位于.Net 4.5中

It's not true.

这不是真的。

To solve this problem check if your dates on client and server are synchronized. Just set the same hour on server and client machine.

要解决此问题,请检查客户端和服务器上的日期是否已同步。只需在服务器和客户端计算机上设置相同的小时。