C#WCFWebService调用接口

C#net6.0 环境
使用WCF Web Service 调用其他系统的接口

img

 //当statue为结案时                     已捕获异常
 Dictionaryif (BaseInfo.PPTA
                     method
                    org.apache.cxf.interceptor.Abstractlogginglnterceptor.getMe
                     SsageLogger(Lorg/apache/cxf/message/Message)Ljava/util/
   reportdatas
                     此异常最初是在此调用堆栈中引发的
 map.AddFIELDO0                        [外部代码1
 string fileJson
 //string]pptadd                     显示调用堆栈              查看详细信息              复制详细信息               启动LiveShare会话
 vcarapiClient vcai
 var binding =new
                     异常设置
                       引发此异常类型时中断
 binding.MaxBuffer
 binding.MaxReceiy
                          从以下位置引发时除外
 binding. SendTimeoSrm.VCAR.Application.dll
                       打开异常设置编辑条件
 Var aaa =awaitv

报错信息:

System.ServiceModel.FaultException: tried to access method org.apache.cxf.interceptor.AbstractLoggingInterceptor.getMessageLogger(Lorg/apache/cxf/message/Message;)Ljava/util/logging/Logger; from class org.apache.cxf.interceptor.LoggingSoapIn at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.b__0(IAsyncResult asyncResult) --- End of stack trace from previous location --- at Srm.VCAR.Application.Commands.CreateD1TeamCommandHandler.HandleAsync(CreateD1TeamCommand request, IDbConnection dbConnection, CancellationToken cancellationToken) in D:\SRM\srm-api\src\Srm.VCAR.Application\D1Team\Commands\CreateD1TeamCommand.cs:line 695

代码如下:

                        string fileJson = JsonConvert.SerializeObject(map);
                        vcarapiClient vcarapi = new vcarapiClient();
                        var binding = new BasicHttpBinding();
                        binding.MaxBufferSize = 10000000;
                        binding.MaxReceivedMessageSize = 10000000;
                        binding.SendTimeout = new TimeSpan(00, 10, 00);
                        var aaa = await vcarapi.Receive8DDataAsync(BaseInfo.Bindid, fileJson);

本地也可以ping通别人的地址,接口文档也可以打开;执行到最后一行就报错了,麻烦各位帮忙看一下

检查下防火墙,端口是否被占用

ServiceModel.FaultException
模块加载失败
CreateD1TeamCommand.cs文件, 695行

该回答引用GPTᴼᴾᴱᴺᴬᴵ
这个错误似乎与 WCF Web Service 的绑定有关,可能是 WCF Web Service 配置不正确。建议您在 WCF Web Service 项目中的 Web.config 文件中检查绑定配置。您需要确保绑定的配置与客户端的配置匹配。

此外,可能会有一些与安全性相关的问题。尝试在客户端的配置中添加以下行以取消验证:

System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;


这将允许客户端接受未经验证的证书。这只是一种测试方法,不应在生产环境中使用。如果问题解决了,则需要使用正确的证书或在服务器上配置正确的证书。
·
另外,请确保您的 WCF Web Service 已在服务器上正确安装和配置,以及已启动并正在运行。如果您无法解决问题,建议您检查服务器上的日志文件以获取更多信息。

这个错误是由于WCF Web Service调用其他系统的接口时,发生了方法调用的错误。具体原因可能是由于接口的参数或返回值类型不匹配,或者是接口的安全性和可靠性设置不正确。要解决这个问题,可以检查WCF Web Service的配置文件和代码,确保接口的参数和返回值类型正确,并且接口的安全性和可靠性设置正确。另外,也可以使用调试器来逐步调试代码,找出错误的具体位置和原因。最后,需要与其他系统的开发人员进行沟通和协作,共同解决问题。
参考于:Cursor 应用