Responsive Ads Here

Tuesday, August 29, 2017

Steps for Creating MSMQ support application

 Steps For Creating MSMQ Support Application


Hi friend's, today we are going to understand ubout MSMQ(Microsoft Message Queuing) and how will setup/configure MSMQ in our local machine.

Now first try to understand about MSMQ.

  1. What is MSMQ?
  2. How Does it Configure in local machine?

1. What is a MSMQ?

MSMQ is stand for Microsoft Message Queuing. Message Queuing is a message infrastructure and a development platform for creating distributed messaging applications for the Microsoft Windows Operating System.Message Queuing is a part of the Windows Operating System.
  • There are different types of Message Queues:
    • Normal Message
    • Acknowledgement Message
    • Respond Message
    • Report Message

2. How Does it Configure in local machine?

Hear mention step by step configure message queue in local machine.
  1. Turn On following Windows Features
  2. Create WCF Service
  3. Config in IIS Server
  4. Manage and Config MSMQ
  5. Open Web Config of WCF Service
  6. Add Binding for it under serviceModel
  7. Add services Attribute in serviceModel
  8. After Completion all above mention step check our service is running  or not

2.1. Turn On following Windows Features

  • Windows Communication Foundation Non-HTTP Activation under .Net Framework 3.5.
  • If we have .Net Framework 4.6 Advanced Services feature then all the features under it.
  • All the features under Internet Information System and Internet Information System Hostable web core.
  • All the features under Microsoft Message Queue Server.
  • All the features under Windows Process Activation Services.
  • As Shown in screenshot.
Fig 1.1

2.2. Create WCF Service

  • Open Visual Studio
  • Create New Project
  • WCF Service Application
  • Give Name and folder location and create
  • Right click on Service.svc
  • Click on View Mark Up

2.3. Config in IIS Server

  • Start > Internet Information Service (IIS) Manager.
  • Right click on Application Pool > Add Application Pool > give name same as your Project name so it will easy to map as shown in fig 3.1.

Fig 3.1
  • Right click on Application Pool > Add Application Pool > give name same as your Project name so it will easy to map as shown in fig 3.1.
  • Right Click on Default Web Site under Sites and Add application > give alias same as your project name > and then select application Pool which you created as shown in fig 3.2.
Fig 3.2
  • Right Click on Default Web Site under Sites and Add application > give alias same as your project name > and then select application Pool which you created as shown in fig 3.2 and browse for your project in physical path and save it.
  • Right click on created site DataPushWCFService> Manage Application> Advance Settings > Enable protocols = http,net.msmq.

2.4. Manage and Config MSMQ

  • Right click on My Computer > Manage > Expand Services and Applications> Expand message Queue > Right Click on Private Queues > New > Private Queue.
Fig 4.1
  • Right click on DataPushWCFService private queue.
  • Properties > Click on Security Tab > add new group or user names > add “IIS APPPOOL\DataPushWCFService” without double quotes in that DataPushWCFService is same name as site in application pool and allow all permissions in that and other users also.

2.5. Open Web Config of WCF Service



  • Go to system.serviceModel
  • Into Service Behaviour there will be one default behavior, add name for that default behaviours. If you need more than one behavior then you can add more than one behaviour as per your requirement as shown in following image and change includeExceptionDetailInFaults to true.



Fig 5.1

2.6. Add Binding for it under ServiceModel


  • Add Bindings Attribute in it
  • In that add .netMsmqBinding attribute as shown below image.
Fig 6.1

2.7. Add services Attribute in ServiceModel

  • Add services Attribute in serviceModel
  • Add Service in that Services attribute with endpoints as shown below.
Fig 7.1
In that name with WcfDemoApp should be your project name and Service1 should be your Service name and add bindingConfiguration will be which you created for it as shown in fig 7.1, add endpoints as shown in fig 7.1 in that Address should be your private queue name as shown in fig 7.1 and bindingConfiguration which you created with name No Security Under Binding attribute of ServiceModel.

2.8. After Completion all above mention step check our service is running  or not

  • After completion of this all steps to check our service is running or not > Open IIS >Click on your Web site> Select yourService.svc file> click on Browse, If it not showing any error then its working fine now code to retrieve or consume this WCF Service, Copy its URL.


2.9. Some known Issues and solutions



  • Create one console Application > Create New Project > Console Application >Browse Folder path > Create > right click on references > Add service reference > give URL which you copied in previous step and add it.

Some known Issues and solutions:

  1. The protocol 'net.msmq' is not supported.
  2. The protocol 'net.tcp' is not supported.
  3. The protocol 'net.formatename' is not supported.
  4. The protocol 'net.pipe' is not supported.

Solution For solution right click on default web site > Edit Binding > and add net.msmq at localhost, net.tcp at 808:*, net.formatename at localhost and net.pipe at * as shown in below fig 9.1.

Fig 9.1.


   5. The requested content appears to be script and will not be served by the static file handler.
Solution: 

  • cmd -> Right click -> Run as administrator
  • cdC:\Windows\Microsoft.NET\Framework\v4.0.30319
  • aspnet_regiis.exe -i.

So, that's all guys i hope these will you to understand msmq and work easy with msmq. 

1 comment:

{ "@context": "http://schema.org", "@type": "Organization", "url": "http://c-sharpnets.blogspot.com/", "logo": "http://c-sharpnets.blogspot.com/images/logo.png" }