Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.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# 使用svcutil生成使用ServiceHost托管的命名管道服务的WCF客户端时出错_C#_Wcf_Svcutil.exe_Protocolexception - Fatal编程技术网

C# 使用svcutil生成使用ServiceHost托管的命名管道服务的WCF客户端时出错

C# 使用svcutil生成使用ServiceHost托管的命名管道服务的WCF客户端时出错,c#,wcf,svcutil.exe,protocolexception,C#,Wcf,Svcutil.exe,Protocolexception,我正在使用以下命令: svcutil.exe/language:c#/out:agnServiceClient.cs/config:app.config 净。pipe://localhost/agnService 我在服务器上得到以下协议异常: 在以下位置需要流安全性: ,但没有安全保障 谈判背景。这可能是由远程端点引起的 其绑定中缺少StreamSecurityBindingElement 服务器配置如下: <system.serviceModel> <binding

我正在使用以下命令:

svcutil.exe/language:c#/out:agnServiceClient.cs/config:app.config 净。pipe://localhost/agnService

我在服务器上得到以下
协议异常

在以下位置需要流安全性: ,但没有安全保障 谈判背景。这可能是由远程端点引起的 其绑定中缺少StreamSecurityBindingElement

服务器配置如下:

<system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_IWordDuplexCommunicationService" closeTimeout="00:01:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:30:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="204003200" maxConnections="10" maxBufferSize="204003200" maxReceivedMessageSize="204003200">
                <readerQuotas maxDepth="204003200" maxStringContentLength="204003200" maxArrayLength="204003200" maxBytesPerRead="204003200" maxNameTableCharCount="204003200" />
                <security mode="Transport">
                    <transport protectionLevel="EncryptAndSign" />
                </security>
            </binding>
        </netNamedPipeBinding>
    </bindings>
    <extensions>
        <behaviorExtensions>
            <add name="sessionToken" type="Agn.Infrastructure.Security.Session.JSessionBehaviorElement, Agn.Infrastructure.Security" />
        </behaviorExtensions>
    </extensions>
    <behaviors>
        <serviceBehaviors>
            <behavior name="returnFaults">
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceMetadata httpGetEnabled="false" />
                <dataContractSerializer maxItemsInObjectGraph="204003200" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="sessionToken">
                <sessionToken />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <services>
        <service name="Agn.Shell.Services.AgnService">
            <endpoint address="net.pipe://localhost/agnService" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IWordDuplexCommunicationService" contract="Agn.Shell.Services.IAgnService"  />
        </service>
    </services>

代码就这么简单:

[ServiceContract]
public interface IAgnService
{
    [OperationContract]
    PageWrapper<Callejero> GetListCallejero(FiltroCallejero filter, PageWrapper page);
}

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single, MaxItemsInObjectGraph = WellKnownGeneralConstants.ImagnaMaxItemsInObjectGraph)]
public class AgnService : IAgnService
{
    private readonly ICallejeroService callejeroService;

    public AgnService(ICallejeroService callejeroService)
    {
        this.callejeroService = callejeroService;
    }

    public PageWrapper<Callejero> GetListCallejero(FiltroCallejero filter, PageWrapper page)
    {
        return this.callejeroService.GetList(filter, page) as PageWrapper<Callejero>;
    }
}
[服务合同]
公共接口IAgnService
{
[经营合同]
PageWrapper GetListCallejero(FiltroCallejero过滤器,PageWrapper页面);
}
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single,InstanceContextMode=InstanceContextMode.Single,MaxItemsInObjectGraph=WellKnownGeneralConstants.ImaganaMaxItemsInObjectGraph)]
公共类服务:IAgnService
{
专用只读ICallejeroService,称为Jeroservice;
公共服务(iCaleJeroservice称为Jeroservice)
{
this.callejeroService=callejeroService;
}
公共页面包装器GetListCallejero(FiltroCallejero筛选器,页面包装器页面)
{
将这个.callejeroService.GetList(过滤器,页面)作为PageWrapper返回;
}
}
启动代码:

public void StartupService()
{
    this.agnServiceHost = new ServiceHost(this.Container.Resolve<IAgnService>());
    this.agnServiceHost.Open();
}
public void启动服务()
{
this.agnServiceHost=新的ServiceHost(this.Container.Resolve());
this.agnServiceHost.Open();
}

有什么提示吗?

你试过这个吗?=>我使用的是命名管道,而不是netTcp.:/