i have deployed a msmq service on IIS7. This service writes messages to eventlogs. I created a private queue with the name of service.
I have referenced the service in the client (Console app). The client passes an integer to the service.
The service is writing the integer to the eventlog.
Everything is good till now..
But when i keep the service down by stopping the DefaultWebSite in IIS, and calling the service from the client ( It is still writing the evnet logs (even though the service is down)..
I was expecting it should not process the request and store the request in the queue until the service is up..
Please help me with this, let me why this is behaving like this..
If i host the service in a console it is behaving as desired.. processing the request when service is up and saving the request in queue when service is down..
namespace WCFMSMQService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
publicinterfaceIService1
{
[OperationContract(IsOneWay = true)]
void GetData(int value);
}
}
Service1.svc.cs
namespace WCFMSMQService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.publicclassService1 : IService1
{
publicvoid GetData(int value)
{
string sSource;
string sLog;
string sMethod;
sSource = "MSMQServiceEventLog";
sLog = "Application";
sMethod = "GetData";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sMethod + "Value passed is " + value.ToString());
EventLog.WriteEntry(sSource, sMethod + "Value passed is " + value.ToString(),
EventLogEntryType.Warning, 234);
}
}
}
Service Web.Config
<services> <servicename="WCFMSMQService.Service1"behaviorConfiguration="ServiceBehavior"> <host> <baseAddresses> <addbaseAddress="http://localhost/WCFMSMQService" /> </baseAddresses> </host> <!-- Service Endpoints --> <endpointaddress="net.msmq://localhost/private/WCFMSMQService/Service1.svc"binding="netMsmqBinding"
contract="WCFMSMQService.IService1"
bindingConfiguration="NoMsmqSecurity"/> <endpointaddress="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/> </service> </services> <bindings> <netMsmqBinding> <bindingname="NoMsmqSecurity"> <securitymode="None" /> </binding> </netMsmqBinding> </bindings> <behaviors> <serviceBehaviors> <behaviorname="ServiceBehavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadatahttpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebugincludeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironmentmultipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modulesrunAllManagedModulesForAllRequests="true"/> </system.webServer>
Client
privatestaticvoid Main(string[] args)
{
try
{
MSMQServiceRef1.Service1Client test = new MSMQServiceRef1.Service1Client();
string num = Console.ReadLine();
test.GetData(Convert.ToInt32(num));
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
The service code and configuration looks ok. As you mentioned, the MSMQ based WCF service still process requests after you stopped the IIS web site(which host the WCF service application). Then, have you also stopped the application pool associated with the
IIS web site(or the specific application virtual directory)?
For IIS 7, since non-HTTP protocol listening is included, the entire processing pipeline is a bit different than the previous version. The worker process will handle both HTTP and non-HTTP requests. However, for HTTP requests, it might be first handled by the
front IIS w3svc process before forward to the WAS worker proccess which will processing all kinds of requests(HTTP and non-HTTP). So, if you haven't stopped the application pool previously, you can also tried stopped the application pool to see if the MSMQ
based WCF service still work.
reddy.net
Member
75 Points
89 Posts
msmq service issue..
Feb 27, 2012 03:21 PM|LINK
Hi
i have deployed a msmq service on IIS7. This service writes messages to eventlogs. I created a private queue with the name of service.
I have referenced the service in the client (Console app). The client passes an integer to the service.
The service is writing the integer to the eventlog.
Everything is good till now..
But when i keep the service down by stopping the DefaultWebSite in IIS, and calling the service from the client ( It is still writing the evnet logs (even though the service is down)..
I was expecting it should not process the request and store the request in the queue until the service is up..
Please help me with this, let me why this is behaving like this..
If i host the service in a console it is behaving as desired.. processing the request when service is up and saving the request in queue when service is down..
Thanks
kushalrdalal
Contributor
7130 Points
1273 Posts
Re: msmq service issue..
Feb 27, 2012 03:49 PM|LINK
Can you post your code?
My Blog
LinkedIn Profile
reddy.net
Member
75 Points
89 Posts
Re: msmq service issue..
Feb 27, 2012 03:55 PM|LINK
Iservice1.csService1.svc.csClientSteven Cheng...
Contributor
4199 Points
548 Posts
Microsoft
Moderator
Re: msmq service issue..
Mar 04, 2012 12:47 PM|LINK
Hi Reddy,
The service code and configuration looks ok. As you mentioned, the MSMQ based WCF service still process requests after you stopped the IIS web site(which host the WCF service application). Then, have you also stopped the application pool associated with the IIS web site(or the specific application virtual directory)?
For IIS 7, since non-HTTP protocol listening is included, the entire processing pipeline is a bit different than the previous version. The worker process will handle both HTTP and non-HTTP requests. However, for HTTP requests, it might be first handled by the front IIS w3svc process before forward to the WAS worker proccess which will processing all kinds of requests(HTTP and non-HTTP). So, if you haven't stopped the application pool previously, you can also tried stopped the application pool to see if the MSMQ based WCF service still work.
#Understanding IIS 7.0 Architecture : Non-HTTP Request Processing
http://programming4.us/website/4244.aspx
Feedback to us
Microsoft One Code Framework