Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 通过ssl连接到wcf服务时出错_C#_Web Services_Wcf_Ssl - Fatal编程技术网

C# 通过ssl连接到wcf服务时出错

C# 通过ssl连接到wcf服务时出错,c#,web-services,wcf,ssl,C#,Web Services,Wcf,Ssl,我已经完成了一个wcf服务,该服务已经发布(我可以通过浏览器连接到它,并且可以看到wsdl),但是当我试图通过我编写的客户端程序使用它时,我获得了一条“验证消息安全性时出错”消息 一些细节:使用者和服务器在同一台机器上(因此这不是使用者和服务器之间时间不同步的情况),我使用自签名证书,服务被放在更大解决方案的一个子部分中,并且它有一个专用的web.config覆盖解决方案 Web.config文件在服务端和消费者端都是相同的(我只是简单地从服务复制粘贴到消费者文件)。使用者使用basicHttp

我已经完成了一个wcf服务,该服务已经发布(我可以通过浏览器连接到它,并且可以看到wsdl),但是当我试图通过我编写的客户端程序使用它时,我获得了一条“验证消息安全性时出错”消息

一些细节:使用者和服务器在同一台机器上(因此这不是使用者和服务器之间时间不同步的情况),我使用自签名证书,服务被放在更大解决方案的一个子部分中,并且它有一个专用的web.config覆盖解决方案

Web.config文件在服务端和消费者端都是相同的(我只是简单地从服务复制粘贴到消费者文件)。使用者使用basicHttpBinding和TransportWithMessageCredential连接,并且在多次尝试后,即使我已经通过Visual Studio工具创建了对服务的服务引用,在使用者代码中,我再次指定绑定类型而不是端点地址

正如我已经说过的,该服务使用自签名证书,并且我已经实现了一个验证类来验证不受信任的证书

当我在consumer类中创建代理对象时,我没有得到任何错误,只有当我尝试使用服务上的任何方法时,我才会收到它。我已经设置了tracelog,但它似乎没有显示任何错误,据我所知:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
    <EventID>262165</EventID>
    <Type>3</Type>
    <SubType Name="Information">0</SubType>
    <Level>8</Level>
    <TimeCreated SystemTime="2014-10-30T10:41:32.4017455Z" />
    <Source Name="System.ServiceModel" />
    <Correlation ActivityID="{43c6480e-e3fe-4916-b3a3-efaa10881db5}" />
    <Execution ProcessName="w3wp" ProcessID="7004" ThreadID="6" />
    <Channel />
    <Computer>WKR1007R</Computer>
</System>
<ApplicationData>
    <TraceData>
        <DataItem>
            <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
            <TraceIdentifier>http://msdn.microsoft.com/it-IT/library/System.ServiceModel.Channels.RequestChannelReplyReceived.aspx</TraceIdentifier>
            <Description>Ricevuta risposta tramite il canale di richiesta</Description>
            <AppDomain>/LM/W3SVC/1/ROOT/PBEWS_Client_Test-1-130591392918713557</AppDomain>
            <Source>System.ServiceModel.Channels.BufferedMessage/2733477</Source>
            <ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord">
                <MessageProperties>
                    <Encoder>text/xml; charset=utf-8</Encoder>
                    <AllowOutputBatching>False</AllowOutputBatching>
                    <Security>
                        <IsAnonymous>False</IsAnonymous>
                        <WindowsIdentityUsed>False</WindowsIdentityUsed>
                    </Security>
                </MessageProperties>
                <MessageHeaders></MessageHeaders>
            </ExtendedData>
        </TraceRecord>
    </DataItem>
</TraceData>

              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]
262165 3. 0 8. WKR1007R http://msdn.microsoft.com/it-IT/library/System.ServiceModel.Channels.RequestChannelReplyReceived.aspx 里希斯塔运河里塞维塔酒店 /LM/W3SVC/1/ROOT/PBEWS_Client_Test-1-130591392918713557 System.ServiceModel.Channels.BufferedMessage/2733477 text/xml;字符集=utf-8 假的 假的 假的

只有使用Fiddler,我才能找到错误:

错误服务器nell'Applicatione'/PBEWS\u Client\u Test'。 确认信息的错误。 描述:不受任何限制的社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区社区。根据别有用心的信息,这是一个非常复杂的问题。

Dettagli eccezione:System.ServiceModel.FaultException:error durante la verifica della sicurezza del messaggio.

              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]
错误代码:


              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]
里加584:
里加585:公共R…合同。Poliprizza Recurperapolizza{ 里加586:返回基地。通道。再返回波利扎(idPolizza,modalita); 里加587:} 里加588:

              </td>
           </tr>
        </table>

              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]

文件源:c:\..\PBEWS\u Client\u Test\Service References\servicerence1\Reference.cs Riga:586

Traccia dello堆栈:

[错误例外:确认信息错误。]
System.Runtime.Remoting.proxy.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)+14799942 System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)+622 PBEWS_Client_Test.servicerence1.PBEWS.recurperapolizza(Int32 idPolizza,Boolean modalita)+0 PBEWS\u Client\u Test.servicerence1.PBEWSClient.recurperapolizza(Int32 idPolizza,Boolean modalita)在c:…\PBEWS\u Client\u Test\Service References\servicerence1\Reference.cs:586中 PBEWS_Client_Test.PBEWS_TestForm.Button1_单击c:…\PBEWS_Client_Test\PBEWS_TestForm.aspx.cs:103中的(对象发送方,事件参数e) System.Web.UI.WebControl.Button.RaisePostBackEvent(String eventArgument)+155 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+3804


              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]
它表示“验证消息安全性时出错”,并引用Reference.cs,即在设置服务引用时由Visual Studio工具创建的文件。从577到590的行包含以下代码:

public PBEWS\u Client\u Test.ServiceReference1.mranagraficabaselist RicercaAnagrafiche(System.Collections.Generic.List criteri){
              </td>
           </tr>
        </table>

        <br>

        <b> File di origine: </b> c:\..\PBEWS_Client_Test\Service References\ServiceReference1\Reference.cs<b> &nbsp;&nbsp; Riga: </b> 586
        <br><br>

        <b>Traccia dello stack:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>

[FaultException: Errore durante la verifica della sicurezza del messaggio.]
返回基地。通道。RicercaAnagrafiche(criteri); } public System.Threading.Tasks.Task RicercaAnagraficheAsync(System.Collections.Generic.List准则){ 返回base.Channel.RicercaAnagraficheAsync(criteri); } public Rgi.PassBroker.WCF.Contracts.Poliprizza recurperapolizza(int idPolizza,bool modalita){ 返回基地.通道.回收基地(idPolizza,modalita); } public System.Threading.Tasks.Task递归polizzaancy(int-idPolizza,bool-modalita){ 返回base.Channel.recurperapolizzaancy(idPolizza,modalita); }