473,549 Members | 2,584 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 6420
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
2443
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...
5
12484
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...
5
4066
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...
0
1378
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
1338
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
962
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...
0
8261
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....
5
9636
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
5689
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...
0
7457
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7483
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...
0
7817
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...
0
6051
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...
0
5092
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...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1949
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
1
1063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
771
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...

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.