Клиент службы Wcf не получает потоковое сообщение

У меня возникла странная проблема. Мое приложение 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";start-info="text/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();

person user3818229    schedule 30.12.2015    source источник
comment
это правильная информация заголовка. покажи код клиента.   -  person Amit Kumar Ghosh    schedule 31.12.2015
comment
@AmitKumarGhosh Вы уверены, что проблема в клиентском коде? Сейчас это очень просто: var a = _fileTransferService.DownloadFile(new ImageDownloadRequest(model.PhotoId));   -  person user3818229    schedule 02.01.2016
comment
@AmitKumarGhosh есть предложения? не могу решить эту проблему..   -  person user3818229    schedule 08.01.2016


Ответы (1)


Я нашел решение! Проблема в настройках автофака. Мне нужно установить имя конфигурации привязки. Правильное решение:

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();
person user3818229    schedule 10.01.2016