簡體   English   中英

WCF服務客戶端未收到流消息

[英]Wcf service client doesn't receive stream message

我有一個奇怪的問題。 我的mvc應用程序不想從wcf服務接收流。 通過發送流,一切正常! 我的Client.dll.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="basicHttpStream" sendTimeout="00:05:00" messageEncoding="Mtom" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:61174/FileTransferService.svc"
                binding="basicHttpBinding" bindingConfiguration="basicHttpStream"
                contract="IFileTransferService" name="basicHttpStream" />
        </client>
    </system.serviceModel>
</configuration>

客戶端收到以下消息:“ multipart / related; type =” application / xop + xml“; start =” http://tempuri.org/0 “; boundary =” uuid:6fc3add5-b28f-4842-a944-0bb6c79d05c6 + id = 6 “;啟動信息=” 文本/ xml “的”

我正在使用Autofac創建頻道:

builder
    .Register(c => new ChannelFactory<IFileTransferService>(
        new BasicHttpBinding(),
        new EndpointAddress("http://localhost:61174/FileTransferService.svc"))).InstancePerLifetimeScope();
builder.Register(c => c.Resolve<ChannelFactory<IFileTransferService>>().CreateChannel())
    .As<IFileTransferService>()
    .UseWcfSafeRelease();

我找到了決定! 問題出在autofac配置中。 我需要設置綁定配置的名稱。 正確的解決方案:

builder.Register(c => new ChannelFactory<IFileTransferService>(
     new BasicHttpBinding("basicHttpStream"),
     new EndpointAddress("http://localhost:61174/FileTransferService.svc"))).InstancePerLifetimeScope();
builder.Register(c => c.Resolve<ChannelFactory<IFileTransferService>>().CreateChannel())
    .As<IFileTransferService>()
    .UseWcfSafeRelease();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM