473,760 Members | 10,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WCF hosted in Windows Service

I am writing a WCF Service using MSMQ hosted in a Windows Service on Windows
XP. All the required components are installed (.NET3, MSMQ, etc).

For some reason my service tries to start and then stops right away. I have
looked at everything and can't see anything wrong - in fact, I started this
a few weeks ago and I swear it was running at one point.

I have included the app.config and service code below - any idea why my
service will not stay running? Thanks!

<?xml version="1.0" encoding="utf-8" ?>

<configuratio n>

<appSettings>

<!-- use appSetting to configure MSMQ queue name -->

<add key="queueTarge t" value=".\privat e$\NodeManagerX act" />

</appSettings>

<system.service Model>

<services>

<service name="Node.Mana ger.MessagingSe rvice"

behaviorConfigu ration="Messagi ngServiceBehavi or">

<host>

<baseAddresse s>

<add baseAddress="ht tp://localhost:8000/Node.Manager/service"/>

</baseAddresses>

</host>

<!-- Define NetMsmqEndpoint -->

<endpoint address="net.ms mq://localhost/private/NodeManagerXact "

binding="netMsm qBinding"

contract="Node. Manager.IMessen ger" />

<endpoint address=""

binding="wsHttp Binding"

contract="Node. Manager.IMessen ger" />

<endpoint address="mex"

binding="mexHtt pBinding"

contract="IMeta dataExchange" />

</service>

</services>

<!--For debugging purposes set the includeExceptio nDetailInFaults attribute
to true-->

<behaviors>

<serviceBehavio rs>

<behavior name="Messaging ServiceBehavior ">

<serviceMetadat a httpGetEnabled= "True"/>

<serviceDebug includeExceptio nDetailInFaults ="False" />

</behavior>

</serviceBehavior s>

</behaviors>

</system.serviceM odel>

</configuration>

[RunInstaller(tr ue)]

public class NodeManagerInst aller : Installer

{

private ServiceProcessI nstaller process;

private ServiceInstalle r service;

public NodeManagerInst aller()

{

process = new ServiceProcessI nstaller();

process.Account = ServiceAccount. LocalSystem;

service = new ServiceInstalle r();

service.Service Name = "NodeManagerSer vice";

Installers.Add( process);

Installers.Add( service);

}

}

public partial class NodeManagerServ ice : ServiceBase

{

public ServiceHost serviceHost = null;

public static void Main()

{

// Get MSMQ queue name from appsettings in configuration.

string queueName = ConfigurationMa nager.AppSettin gs["queueTarge t"];

// Create the transacted MSMQ queue if necessary.

if (!MessageQueue. Exists(queueNam e))

MessageQueue.Cr eate(queueName, true);

ServiceBase.Run (new NodeManagerServ ice());

}

public NodeManagerServ ice()

{

InitializeCompo nent();

ServiceName = "NodeManagerSer vice";

}

protected override void OnStart(string[] args)

{

if (serviceHost != null)

{

serviceHost.Clo se();

}

serviceHost = new ServiceHost(typ eof(MessagingSe rvice));

serviceHost.Ope n();

}

protected override void OnStop()

{

if (serviceHost != null)

{

serviceHost.Clo se();

serviceHost = null;

}

}

}
Mar 9 '07 #1
1 6430
Nevermind - I found the problem. I was specifying MSMQ binding which doesn't
support the two-way communication specified in my contract. Thanks anyway -
hopefully this helps someone else. :-)

"Karch" <no****@absotut ely.comwrote in message
news:e$******** *****@TK2MSFTNG P04.phx.gbl...
>I am writing a WCF Service using MSMQ hosted in a Windows Service on
Windows XP. All the required components are installed (.NET3, MSMQ, etc).

For some reason my service tries to start and then stops right away. I
have looked at everything and can't see anything wrong - in fact, I
started this a few weeks ago and I swear it was running at one point.

I have included the app.config and service code below - any idea why my
service will not stay running? Thanks!

<?xml version="1.0" encoding="utf-8" ?>

<configuratio n>

<appSettings>

<!-- use appSetting to configure MSMQ queue name -->

<add key="queueTarge t" value=".\privat e$\NodeManagerX act" />

</appSettings>

<system.service Model>

<services>

<service name="Node.Mana ger.MessagingSe rvice"

behaviorConfigu ration="Messagi ngServiceBehavi or">

<host>

<baseAddresse s>

<add baseAddress="ht tp://localhost:8000/Node.Manager/service"/>

</baseAddresses>

</host>

<!-- Define NetMsmqEndpoint -->

<endpoint address="net.ms mq://localhost/private/NodeManagerXact "

binding="netMsm qBinding"

contract="Node. Manager.IMessen ger" />

<endpoint address=""

binding="wsHttp Binding"

contract="Node. Manager.IMessen ger" />

<endpoint address="mex"

binding="mexHtt pBinding"

contract="IMeta dataExchange" />

</service>

</services>

<!--For debugging purposes set the includeExceptio nDetailInFaults
attribute to true-->

<behaviors>

<serviceBehavio rs>

<behavior name="Messaging ServiceBehavior ">

<serviceMetadat a httpGetEnabled= "True"/>

<serviceDebug includeExceptio nDetailInFaults ="False" />

</behavior>

</serviceBehavior s>

</behaviors>

</system.serviceM odel>

</configuration>

[RunInstaller(tr ue)]

public class NodeManagerInst aller : Installer

{

private ServiceProcessI nstaller process;

private ServiceInstalle r service;

public NodeManagerInst aller()

{

process = new ServiceProcessI nstaller();

process.Account = ServiceAccount. LocalSystem;

service = new ServiceInstalle r();

service.Service Name = "NodeManagerSer vice";

Installers.Add( process);

Installers.Add( service);

}

}

public partial class NodeManagerServ ice : ServiceBase

{

public ServiceHost serviceHost = null;

public static void Main()

{

// Get MSMQ queue name from appsettings in configuration.

string queueName = ConfigurationMa nager.AppSettin gs["queueTarge t"];

// Create the transacted MSMQ queue if necessary.

if (!MessageQueue. Exists(queueNam e))

MessageQueue.Cr eate(queueName, true);

ServiceBase.Run (new NodeManagerServ ice());

}

public NodeManagerServ ice()

{

InitializeCompo nent();

ServiceName = "NodeManagerSer vice";

}

protected override void OnStart(string[] args)

{

if (serviceHost != null)

{

serviceHost.Clo se();

}

serviceHost = new ServiceHost(typ eof(MessagingSe rvice));

serviceHost.Ope n();

}

protected override void OnStop()

{

if (serviceHost != null)

{

serviceHost.Clo se();

serviceHost = null;

}

}

}


Mar 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2455
by: Julia | last post by:
Hi, My client uses a remote object when I host the remote object inside a windows application all seem to work fine but when I host the same object inside a windows service I get the following error " connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because
5
12525
by: Nate | last post by:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error (that appears in plain text), and causes the client to crash. This C# code has been deployed both as an ASP.NET application and a WinForms app, each of which produced the same result. Further, moving the clients from a Windows XP machine to Windows...
5
4095
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names The DLL's have been copied to the /bin directory in both web virtual directories.
0
1390
by: vasu devan | last post by:
Dear Gurus, My ASP.NET website is running on .NET 1.1. hosted in windows server 2003 enterprise edition. We are having two sites. They are 1. One internet site 2. One intranet site. Both these sites are having same aspx pages. No difference at all between them in page content.
0
1348
by: Vasu | last post by:
Hi All, My ASP.NET website is running on .NET 1.1. hosted in windows server 2003 enterprise edition. We are having two sites. They are 1. One internet site 2. One intranet site. Both these sites are having same aspx pages. No difference at all
0
972
by: kCura | last post by:
I've got an web application that's using a hosted form in IE. The server that is hosting it is running Windows Server 2003 with SP1 and the .NET 1.1 framework. It has all of the latest and greatest service packs and updates. Everything has been working fine up to this point. The other day, however, we switched our site over so that it uses SSL, and we've noticed that the Hosted Form no longer works. When I go to the hosted form with a...
0
8278
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= | last post by:
I have written a simple WCF service hosted in a Windows console application and a simple WCF client console application that connects successfully to that service and retrieves data. I then ported the console application to WinForms and also got that to work properly. My next move was to host the WCF service in a Windows service application. I believe I have that working correctly, but I can't for the life of me get a client to connect...
5
9667
by: paul korosi | last post by:
Hi, I've got a wcf service that is hosted on my local machine. I need to determine the hosted url of the service from within the service but cannot work out how to do it. HttpContext.Current always returns null, which i suppose might make some sense. Does anyone know of a way to get the url? TIA, paul
0
5714
by: khurramlone | last post by:
I am trying to generate a client proxy from a WCF service library. I am using VS2005, .NET 3.0 on a Windows XP Pro workstation. The WCF service is hosted in a windows service. When I run the windows service as a console application, there are no problems. I can run svcutil.exe against that address and it generates the proxy. However, when I compile that service in release mode, and install it on the workstation using InstallUtil, I get an error...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.