3

I'm trying to setup a very simple WCF service using MSMQ. I am following the steps here. When I go to run my service and load the .svc file, I get the following error:

The protocol 'net.msmq' is not supported.

Here's the relevant part of my config:

<services>
  <service name="MSMQService.MSMQService">
    <host>
      <baseAddresses>
        <add baseAddress="http://technoka1-l7:9999/"/>
      </baseAddresses>
    </host>
    <endpoint address="net.msmq://technoka1-l7/private/MSMQService.svc"
              binding="netMsmqBinding" contract="MSMQService.IMSMQService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

Any ideas on how to fix would be greatly appreciated. I've looked at a lot of different places that make suggestions for IIS, but this is running within Cassini right now.

zimdanen
  • 5,508
  • 7
  • 44
  • 89
  • could this be a help? I dont know your configuration: http://msdn.microsoft.com/en-us/library/cc656912(v=vs.100).aspx#features_not_included_in_the_net_framework_client_profile – Chris Oct 23 '12 at 15:22
  • @Chris: I'm targetting .NET Framework 4, so I should have everything. – zimdanen Oct 23 '12 at 15:23

5 Answers5

2

That looks like an error you'd get from IIS. If you are hosting your service in IIS, look at this brief blog post on setting up IIS to handle the netMsmqBinding. For hosting in a Windows service, this old Byte form post has enough to get you going.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51
  • I'm running in Cassini, the development server that ships with Visual Studio. – zimdanen Oct 23 '12 at 16:48
  • 1
    When I work with services using `netMsmqBinding`, I've always used either a console host project or IIS. I believe that Cassini does support that binding but have seen any documentation that shows how to configure it. I'd look carefully at how you're configuring the MSMQ endpoint in the `serviceModel` element to make sure it is correct. Sorry, can't provide any more info. – Sixto Saez Oct 23 '12 at 17:07
  • When you say console-hosted, you don't mean a Windows service, right? That's Cassini, then. That's the development server that pops up when you hit F5. – zimdanen Oct 23 '12 at 17:33
  • Right, it's a WCF service hosted in a Visual Studio Console project not a Windows service project. Here is an [MSDN article with a sample service using the MSMQ binding](http://msdn.microsoft.com/en-us/library/ms789032.aspx) in a way that can hosted in a console project. This is what generally we use for development since we already have template code that encapsulated this technique. – Sixto Saez Oct 24 '12 at 02:37
  • So we can't use Cassini - have to self host? – zimdanen Oct 24 '12 at 13:58
  • I can't say whether Cassini works or not. Our applications use a custom `ServiceHostFactory` for a number of reasons. Working locally from a Console project is usually more accessible for debugging than going through IIS. – Sixto Saez Oct 24 '12 at 15:24
1

I recommend that you shift to IIS, the protocol has to be enabled in IIS itself, the fact that you are using a console, service, etc doesn't really matter. The host to your service is IIS, it's activator because of the protocol you are using and how you are using it.

Reference: http://geekswithblogs.net/LessonsLearned/archive/2010/12/27/the-protocol-net.msmq-is-not-supported.aspx

Karell Ste-Marie
  • 1,022
  • 1
  • 10
  • 22
  • Are you saying there's no way to run an MSMQ-based WCF service locally? – zimdanen Oct 23 '12 at 17:47
  • Yes, if you use the full-blown version of IIS - There is a switch for IIS-Based projects to use the full-blown version of IIS, simply check it and your should be good. – Karell Ste-Marie Oct 23 '12 at 21:05
  • Better still, use a windows service to host your queue reader service – tom redfern Oct 24 '12 at 08:15
  • I'm specifically looking for a way to do it **without** using full-blown IIS. – zimdanen Oct 24 '12 at 13:46
  • Looking into WAS may be your option then, unfortunately, I have almost no information on what that means. Our company used to use WCF but we moved to REST in the last 12 months. You may want to look into NServiceBus as it can expose WCF services that get dropped into queues immediately which the "Workers" can then execute. It's an amazing product. MassTransit works on the same principles. – Karell Ste-Marie Oct 24 '12 at 14:01
1

Looks like Cassini only supports http, so there is no way to run straight from Visual Studio.

zimdanen
  • 5,508
  • 7
  • 44
  • 89
1

1) If you host your service manually(using console or another windows application), everything works fine.
2) If you try to start wcf service application, msmq binding is not supported. I haven't found solution for this problem yet.
3) If you host your wcf service using IIS, ensure both the SITE and APPLICATION support msmq protocol:

  1. Site->Bindings. Add msmq binding if it is necessary.
  2. Site->Extensive settings->Active protocols. Add "net.msmq" if it is necessary.
  3. Application->Extensive settings->Active protocols. Add "net.msmq" if it is necessary.
Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
Mihail
  • 11
  • 2
0

I was also looking for a way to debug WCF net.msmq services in IIS running straight from Visual Studio. I came across this great post which allows me to do it.

http://codenamesean.wordpress.com/2012/09/26/debugging-a-net-msmq-wcf-service-hosted-in-iis-7/

  • Start w3wp.exe process by selecting the “Browse *:80 (http)” link of your virtual directory in IIS
  • Debug Menu => Attach to w3wp.exe process
  • Run Client
  • Activate the Windows Process Activation Service by clicking on the virtual directory and browsing to your Service.svc. (Note: I didn't have to do this step for it to debug.)
user3507000
  • 81
  • 1
  • 2