Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 使用WCF服务时的安全/授权_.net_Wcf_Rest_Authorization_Credentials - Fatal编程技术网

.net 使用WCF服务时的安全/授权

.net 使用WCF服务时的安全/授权,.net,wcf,rest,authorization,credentials,.net,Wcf,Rest,Authorization,Credentials,我对WCF有些陌生。我已经创建了一个服务,它可以正常工作。该服务接收XML字符串中的一些请求键,并返回XML结果集 这是我的一般性问题,然后我会给出一些细节。如果有人使用wsHttpBinding在WCF中创建RESTful服务,那么从外部使用该服务的人是否需要提供用户名/PW凭据 好的,细节。在服务器端,以下是核心配置: <services> <service behaviorConfiguration="MyService1Behavior" name="MyRe

我对WCF有些陌生。我已经创建了一个服务,它可以正常工作。该服务接收XML字符串中的一些请求键,并返回XML结果集

这是我的一般性问题,然后我会给出一些细节。如果有人使用wsHttpBinding在WCF中创建RESTful服务,那么从外部使用该服务的人是否需要提供用户名/PW凭据

好的,细节。在服务器端,以下是核心配置:

<services>
    <service behaviorConfiguration="MyService1Behavior"  name="MyRestService">
        <endpoint 
            address="http://(address)/myweb/myrestservice.svc"  
            binding="wsHttpBinding"  
            contract="IMyRestService">
          <identity> <dns value="numeric address" />  </identity> 
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
</services>
就像我说的,当我从一个完全在域之外的系统中使用它时,这一切都会起作用

但我必须提供如下凭证:

MyClientService.ClientCredentials.Windows.ClientCredential.Domain = "remoteserver";
MyClientService.ClientCredentials.Windows.ClientCredential.UserName = "UserID";
MyClientService.ClientCredentials.Windows.ClientCredential.Password = "Password";
我有点担心,如果有人试图使用非.NET客户端使用该服务,他可能不想提供凭据。所以-如果我使用WCF创建了一个RESTful服务并将其托管在IIS上……外部访问该服务的人是否需要提供凭据,或者是否有一种方法可以安全地提出不同的解决方案

再一次,我意识到我在知识上有差距——只是想填补这些差距


提前感谢您的建议……

正如Marc在评论中所说的,可以说您实现的并不是真正的服务,而是一种基于SOAP 1.2的服务

但是,由于您使用的是wsHttpBinding,您可以确信服务和使用者之间的任何通信都将受到该绑定堆栈的限制,而该绑定堆栈又实现了soap扩展

这实际上意味着,不仅非.net使用者将得到安全保护,而且可能还会因为wsHttpBinding的默认设置对互操作性不是很开放,例如,默认情况下它使用windows身份验证,正如您在上面所发现的那样

如果您需要支持非.net客户端,那么使用使用SOAP1.1的。如果需要,您可以使用SSL和用户名/密码或证书

wsHttpBinding不是RESTful绑定——它是SOAP。使此服务成为REST服务的唯一绑定是webHttpBinding
MyClientService.ClientCredentials.Windows.ClientCredential.Domain = "remoteserver";
MyClientService.ClientCredentials.Windows.ClientCredential.UserName = "UserID";
MyClientService.ClientCredentials.Windows.ClientCredential.Password = "Password";