部署WCF遇到的问题及解决方案

WCF:调用方未由服务器进行身份验证

服务端添加以下节点:设置安全验证为None;

< bindings >
< wsHttpBinding >
< binding name ="NoneSecurity" >
< security mode ="None" > security >
binding >
wsHttpBinding >
bindings >

同时设置Service节点下的endpoint节点的bindingConfiguration="NoneSecurity";

然后将客户端config文件中的security节配置改为

服务端完整配置文件如下:

xml version="1.0" encoding="utf-8" ?>
< configuration >
< system.serviceModel >
< services >
< service name ="MyContract.MyService" behaviorConfiguration ="MyContract.IMyService" >
< host >
< baseAddresses >
< add baseAddress ="http://10.8.3.61:8080/MyService/" />
baseAddresses >
host >
< endpoint address ="" binding ="wsHttpBinding" contract ="MyContract.IMyService" bindingConfiguration ="NoneSecurity" />

service >
services >
< behaviors >
< serviceBehaviors >
< behavior name ="MyContract.IMyService" >
< serviceMetadata httpGetEnabled ="true" httpGetUrl ="" />
behavior >
serviceBehaviors >
behaviors >
< bindings >
< wsHttpBinding >
< binding name ="NoneSecurity" >
< security mode ="None" > security >
binding >
wsHttpBinding >
bindings >
system.serviceModel >
configuration >

你可能感兴趣的:(部署WCF遇到的问题及解决方案)