当前位置: 首页 > 编程语言 > C#

MessageSecurityExceptionNosignaturemessagepartspecifiedformessagewith-http---...-operation分享

时间:2023-04-10 19:46:39 C#

MessageSecurityExceptionNosignaturemessagepartformessagewith"http://..."operationThisisclientand服务器使用的配置文件是我收到错误的这段代码。ProgrammingMaster_ServiceClientaClient=newProgrammingMaster_ServiceClient();aClient.BeginProgrammingSession(0x01);aClient.Close();第二行是发生异常的地方。使用svcutil.exe工具创建ProgrammingMaster_ServiceClient。这是我用来启动服务器的代码。publicboolStartService(stringaIp){stringlsInstanceId=pFBlock.InstanceId.ToString();UriloBaseAddr=newUri(string.Format("http://localhost:808{0}/{1}",lsInstanceId,pFBlock.FBlockName));pLocalHost=newServiceHost(typeof(Shadow_ProgrammingMasterService),loBaseAddr);开始(aIp);返回IsHostOpen;}privatevoidStart(stringaIp){Shadow_ProgrammingMasterService.SetAPI(this);尝试{pLocalHost.AddServiceEndpoint(typeof(IProgrammingMaster_Service),newWSHttpBinding(),"PM_Service");ServiceMetadataBehaviorloSmb=newServiceMetadataBehavior();loSmb.HttpGetEnabled=true;pLocalHost.Description.Behaviors.Add(loSmb);尝试{pLocalHost.Open();IsHostOpen=真;pPM_Client=newProgrammingMasterProxyClient(this,pOutput);pPM_Client.IpAddress=aIp;这个。订阅(pPM_Client);pOutput.setComment("ProgrammingMasterService已初始化");}catch(CommunicationExceptionce){pOutput.setError(ce.Message);pLocalHost.Abort();IsHostOpen=假;}}catch(CommunicationExceptionex){pOutput.setError(ex.Message);pLocalHost.Abort();IsHostOpen=false;//this.Unsubscribe(pOSTTSClient);//pOSTTSClient=null;谁有任何想法可能是什么原因造成的?在您的案例中发生这种情况的原因很简单,WCF服务代码本身已被修改、重新编译(并且基本上部署在调试器中),并且客户端(具有现在已过时的服务引用)期望并取决于更新客户端的服务由于与受此更改影响的内容发生冲突而引起的参考将更正此问题。继续,以上并不意味着一旦客户端引用了服务本身(不破坏客户端),您就不能更改服务中的任何代码,但是,像这样的问题表明服务的某些部分会发生变化显著地。客户端依赖于,例如,暴露方法的签名,现有DataContract类型的现有DataMember属性等。相比之下,您可以将现有服务调用的方法体更改为您的内容(客户端不不关心服务如何工作,如何让它工作);您还可以向现有复合DataContract类型添加新成员,以便新客户端可以轻松使用您的更新,防止DataType2类型方案具有冗余等。以上是C#学习教程:MessageSecurityExceptiondoesnotspecifyasignatureforthemessagewith“http://...”操作。留言部分全部内容分享。如果对大家有用,需要进一步了解C#学习教程,希望大家多多关注——本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:

最新推荐
猜你喜欢