本文介绍了WCF和MSMQ集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的WCF应用程序以了解MSMQ.
我只希望在客户端应用程序运行时将任何文本存储在MSMQ中.

Clientwebconfig--

I am trying to create a simple WCF application to learn about MSMQ.
i just want any text to be stored in MSMQ when client application runs.

Clientwebconfig--

<configuration>
    <system.servicemodel>
        <bindings>
            <basichttpbinding>
                <binding name="BasicHttpBinding_IHello" closetimeout="00:01:00">
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
            </basichttpbinding>
        </bindings>
        <client>
            <!--<endpoint address="http://localhost/Hello/" binding="basicHttpBinding">
                bindingConfiguration="BasicHttpBinding_IHello" contract="IHello"
                name="BasicHttpBinding_IHello" />-->
          <endpoint address="net.msmq://localhost:8080/Hello/">
          binding="netMsmqBinding"
          contract="IHello" />
        </endpoint></endpoint></client>
    </system.servicemodel>
</configuration>



和客户代码是-



and client code is-

using System;
using System.ServiceModel.Channels;
using System.Configuration;
using System.Messaging;
using System.ServiceModel;
using System.Transactions;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace client
{
    class Program
    {
        static void Main(string[] args)
		{
			Console.WriteLine("Press any key when the service is available...");
			Console.ReadKey();
			
			HelloClient client = new HelloClient();
			
           Console.WriteLine("this is client and it means service is runing");
			Console.WriteLine("Press any key to quit...");
			Console.ReadKey();
		}
    }
}



我只是这个主题的初学者,并尝试学习WCF和MSMQ.
提前致谢



I am mere begineer in this topic,and trying to learn WCF amd MSMQ.
Thanks in Advance

推荐答案


这篇关于WCF和MSMQ集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 01:20