错误:由于ContractFilter在EndpointDispatcher不匹配,因此Action为<BtsActionMapping...的消息无法在接收方处理

7 篇文章 0 订阅

错误描述:

“由于 ContractFilter 在 EndpointDispatcher 不儿还,因此 Action 为http://tempuri.org/llnStoreReceiveGoodsService/PingZhengSave"的消息无注在接收方处理。这可能是由于协定不匹配(发送方和接收方 Action 不配)或发送和接收方绑定/安全不匹配。请检齐发送方和接收方是否具有相同的协定和绑定(包括安全要求,如 Message、 Transport、 None).”;
在这里插入图片描述

这是由于原项目中,上传功能写在了另一个解决方案的项目中,所以服务也需要迁移,我把按钮功能迁移到当前解决方案的项目中,重写了代码以及服务。
旧上传功能代码:

 //1.1 添加图片到服务器路径
 var re = System.Convert.FromBase64String(item.Photo);
 var shpzPath = Configuration.GetSection("ReceivePingZheng:Path").Value;
 if (!Directory.Exists(shpzPath))
 {
     Directory.CreateDirectory(shpzPath);
 }
  using (FileStream fs = new FileStream(System.IO.Path.Combine(shpzPath, guid.ToString() + item.FileExtension), FileMode.Create))
  {
     using (BinaryWriter binary = new BinaryWriter(fs))
     {
         binary.Write(re, 0, re.Length);
     }
  }

旧上传服务(写在专门给当前项目提供服务的json文件中):

"ReceivePingZheng": {"Path": "E://zjd", "ServerUrl": "http://192.168.80.33:8081" }

新上传功能代码:

 //2.1遍历明细添加图片
var re = System.Convert.FromBase64String(item.Photo);
var shpzPath = ConfigurationManager.AppSettings["ReceivePingZheng"];//获取具有指定键的配置子节
if (!Directory.Exists(shpzPath))
{
   //在指定文件中创建目录
   Directory.CreateDirectory(shpzPath);
}
using (FileStream fs = new FileStream(System.IO.Path.Combine(shpzPath, detailID.ToString() + item.FileExtension), FileMode.Create))
{
    using (BinaryWriter binary = new BinaryWriter(fs))
    {
      binary.Write(re, 0, re.Length);
     }
 }

新上传服务(写在web.config中):

<add key="ReceivePingZheng" value="E://pzsc" />
  • 获取配置项请见之前博客

因为我修改了ReceivePingZheng凭证服务,所以当我自己运行的时候没有问题。但将客户端打包让别人使用时就会出现以上报错的问题,我们需要将本地server服务打开供其他人访问。也就是svc的地址
解决办法:
1、将提供服务的项目打包发布

(将提供服务得web打包)
2、在iis中配置网站,将打包好的web发布在iis上,并启动网站
3、在iis中浏览发布好的网站,让它在浏览器中运行就可以了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值