By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 769 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Hosting in Windows services

P: n/a
Hi,

I created a web service that I want to host in windows service. The
problem is that if I host it as windows service it does not use the
configuration file. I have to define the binding, endpoint etc.
programmatically in the Program.cs file.

Any idea what I might be doing wrong?

Cheers,

Manjree
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Manjree,

From your description, you're using windows service to host a WCF service,
however, you found that the windows hosted WCF service can not use
configuration file to do the service & endpoint configuration ,correct?

Based on my research, windows service hosted WCF service also read
configuration from the app.config file. I've also performed test through
the approach mentioend in the following MSDN reference:

#How to: Host a WCF Service in a Managed Windows Service
http://msdn.microsoft.com/en-us/library/ms733069.aspx

the steps are as below:

** create a C# .NET windows service project

** add WCF service interface/class in it (also with the system.serviceModel
configuration in the windows service project's app.config file)

** add code to create servicehost in windows service's "OnStart" event, and
close it in "OnEnd" event.

** add a installer class for the windows service

** install the windows service via "installutil.exe" from visual studio
command prompt

after the above, when I start the windows service from mmc console, I can
correctly visit the meta data(wsdl) page and call it from other application.

For your scenario, are you also using the built-in project type to create
the windows service? Or is there anything different here?

If there is anything I missed, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: =?Utf-8?B?TWFuanJlZSBHYXJn?= <ga**@newsgroup.nospam>
Subject: Hosting in Windows services
Date: Wed, 21 May 2008 07:15:04 -0700
Hi,

I created a web service that I want to host in windows service. The
problem is that if I host it as windows service it does not use the
configuration file. I have to define the binding, endpoint etc.
programmatically in the Program.cs file.

Any idea what I might be doing wrong?

Cheers,

Manjree

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.