分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

.net的webservice中内外网端口不一致导致无法调用的解决方案

发布时间:2023-09-06 02:33责任编辑:顾先生关键词:webservice

再生产wsdl文件时重写描述文件

 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.Services.Description; 6 ?7 namespace StrongSoftManage.Web.App 8 { 9 ????public class SoapExtens : SoapExtensionReflector10 ????{11 ????????public override void ReflectMethod()12 13 ????????{14 15 ????????????//no-op16 17 ????????}18 19 ????????public override void ReflectDescription()20 21 ????????{22 23 ????????????ServiceDescription description = ReflectionContext.ServiceDescription;24 25 ????????????foreach (Service service in description.Services)26 27 ????????????{28 29 ????????????????foreach (Port port in service.Ports)30 31 ????????????????{32 33 ????????????????????foreach (ServiceDescriptionFormatExtension extension in port.Extensions)34 35 ????????????????????{36 37 ????????????????????????SoapAddressBinding binding = extension as SoapAddressBinding;38 39 ????????????????????????if (null != binding)40 ????????????????????????{41 ????????????????????????????binding.Location = binding.Location.Replace("8080", "9080");42 ????????????????????????}43 44 ????????????????????}45 46 ????????????????}47 48 ????????????}49 ????????}50 ????}51 }

.net的webservice中内外网端口不一致导致无法调用的解决方案

原文地址:https://www.cnblogs.com/ysf123/p/10373704.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved