调用WCF,出现“调用方未由服务器进行身份验证”错误

c9cad 2017-09-06 08:28:29
我是参照http://blog.csdn.net/songyefei/article/details/7381595做的一个例子,在本机能够调用,部署到其他主机就会出现错误。
文件一共三个:
web.config
<configuration>
<system.serviceModel>
<services>
<service name="LearnWCF.HelloWCFService" behaviorConfiguration="metadataExchange">
<endpoint address="" binding="wsHttpBinding" contract="LearnWCF.IHelloWCF"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>

</services>

<behaviors>
<serviceBehaviors>
<behavior name="metadataExchange">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


HelloWCFService.cs 放在App_Code文件夹中

using System;
using System.ServiceModel;

namespace LearnWCF
{
[ServiceContract]
public interface IHelloWCF
{
[OperationContract]
string HelloWCF();
}

public class HelloWCFService : IHelloWCF
{
public string HelloWCF()
{
return "Hello WCF!";
}
}
}

HelloWCFService.svc
<%@ ServiceHost language=c# Debug="true" Service="LearnWCF.HelloWCFService" %>


部署在服务器上,在客户端通过浏览器也能够访问,如下:


客户端就是一个winfrom,能够引用WCF,有一个文本框和一个按钮,点击按钮,显示WCF的内容,但出现如下错误:

...全文
415 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
c9cad 2017-09-11
  • 打赏
  • 举报
回复
这个问题没有人碰到吗?
c9cad 2017-09-08
  • 打赏
  • 举报
回复
大虾,快出来,江湖救急啊。
c9cad 2017-09-07
  • 打赏
  • 举报
回复
有解决过的兄弟吗?

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧