.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

deploy a WCF service, hosting in Windows Service with NamedPipe binding

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :WCF

Hi, I developed a wcf service, hosted in Windows service with Namedpipe binding, and  a client application that were both in .net 4.0

both work well in my development computer, in Win 7
when i deployed both service and client in another computer. the service works, but the client cannot access the service.

with EndpointNot Found exception
when I changed binding to wsHttpBinding, the client failed to call the service with SecurityNegotiationException



View Complete Post

More Related Resource Links

Web Service Workflows: Deploy Distributed Business Processes With Windows Workflow And Web Services


Due to the distributed nature of a business process it makes sense for a workflow to be deployed as a distributed application. See how Windows Workflow and Web Services hold the key.

Israel Hilerio

MSDN Magazine October 2006

WCF Windows service hosting - not starting

Hi every experts i have WCF Service and a Windows service project for hosting that service when i install the win service with installutil and click start in services it show this message : "Windows could not start the Virtual WCF Service service on Local Computer. Error 5: Access is denied." i have this problem with this sample too : http://rapidshare.com/files/415123228/WCFSample.rar how can i fix this? THX

Hosting IIS vs Windows Service !!!!

Hi, could you please explain me about the Pros and Cons Between the Hosting the service in IIS vs Windows Service General Term. why iam asking is,my dev server is installed with IIS 7(win 2k8)which ofcourse supports IIS and windows service(netTCPBinding).so please explain me on the same above.

Need help understanding why to use 'ServiceBase.Run' in Windows Service hosting a WCF service

A year or 2 ago I successfully implemented a WCF service hosted in a Windows Service.  Now I am going to do another one, so I went back to my 1st project.  Based on the following links example (http://msdn.microsoft.com/en-us/library/ms733069.aspx) and my 1st project I implmented the following code: Public Shared Sub Main() ServiceBase.Run(New MyWindowsService()) End Sub Now, I read up on this in the MSDN and understand that registers the service with the SCM and calls the onStart method, correct?  The way I read it, this code is necessary.However, now I am looking at a few newer examples of hosting a WCF service in a Windows Service, and the 'Main' Sub with that 'ServiceBase.Run' call is not even included, but apparently still works.  For example the following MSDN tutorial doesn't use that call at all:  http://msdn.microsoft.com/en-us/library/cc949080.aspx#    It just has the onStart method overloaded which I also do.So my questions are, is that code in Sub Main needed and why?  Doesn't pressing start from the 'Services Manager' console call the onStart method anyways of the service?Thank you,

Hosting web service inside Windows Application

  I would like to host my web service inside windows application. I prepared a short example basing on: http://msdn.microsoft.com/en-us/library/aa529311.aspx I have 2 projects created with default templates: Web Service project where I did not change anything: namespace WebService1 { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service() { } [WebMethod] public string HelloWorld() { return "Hello World"; } } } Windows Project in which I changed only the main form class: public partial class Form1 : Form { public Form1() { InitializeComponent(); Uri address = new Uri("soap.tcp://localhost/TestService"); SoapReceivers.Add(new EndpointReference(address), typeof(WebService1.Service)); } } The problem is that when I compile and run this Windows Application, I can`t discover this Web Service. There must be something wrong in my solution. Could you please help me by telling what may be wrong? Thank you for help in advance.MCP

Error 400 when hosting windows streaming service.

WCF, .NET 3.5:I'm sorry if this is redundant, but I'm having problems receiving error: 400 requests. My particular issue is this: If I select my service library within VS the library is test hosted and I can stream large files. My problem is getting a windows service configured to host this service library. I can transfer small files but larger ones are failing with the following stacktrace: <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> <EventID>262155</EventID> <Type>3</Type> <SubType Name="Error">0</SubType> <Level>2</Level> <TimeCreated SystemTime="2009-11-18T19:58:07.7808550Z" /> <Source Name="System.ServiceModel" /> <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> <Execution ProcessName="ExtractorTestClient.vshost" ProcessID="10768" ThreadID="9" /> <Channel /> <Computer>MyComputer</Computer> </System> <ApplicationData> <TraceData> <DataItem> <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"> <TraceIdentifier>http://msdn.microsoft.com/en-US/library/Syste

Set Up and deploy a C# windows service app on different servers.


C# Visual Studio 2008 Prof. Ed.  I have created a windows service app.  I can use the Vs installutil to get it running on my Win 7 laptop just fine.  I am looking for the best way for other Admins to install this service on a number of windows web servers.  I would like for these users to simply click on some sort of Setup.exe and have the service be installed (and started) without using the Vs installutil to do this.

I believe I have to add an Install Component as well as a Set Up project to the windows service solution to accomplish this.  The tutorials I have looked at are confusing to me or they are written for other VS versions.

1 - If someone has gone thru this or has a link for me to look at for guidance I would greatly appreciate it.

2 - Can anyone please tell me C# (CSharpWannaB) from a birds eye view what the purpose of each, the Installer and Set_up components are?  Also  how are they dependent on each other as well as the app I am trying to Deploy?


calling and hosting WCF services from windows service


I have 2 windows services. Both hosting their own WCF service and it works fine.

Now one windows service (let call it the second) does need some information from the first windows service.
So I make the second dependend on the first.
This all works fine untill the second windows service starts (it started the first automatically because of dependency).
I make a call to a wcf method (even before ServiceBase.Run) from inside the second windows service towards the first. This will timeout.

I have tackled this problem by making the wcf call after ServiceBase.Run (in the OnStart method) so it looks like the program is not possible to make a wcf call before it is hosted itself (am I right?).

However when I reboot the computer the second service fails to start (startup type is automatically and the first service is started first).
The dependend service fails to start, after that, when I start it manually it will succeed

How do I make this communication work

Windows service hosting WCF service errors with Error ID 7034, WindowsService service terminated une



We have a number of windows services that are hosting a WCF 4.0 service each (Windows 2003 R2 Stardard SP2)

Invariably we are getting An error from Service Control Manager with this error id:7034

The description states:

"The RMWindowsService service terminated unexpectedly.  It has done this 1 time(s)."

We have 10 services running on 5 servers (Prod, Pre-Prod, Support, Test,Dev)

All servers are Windows 2003 R2 Stardard SP2.

All Services are experiencing the error. 

Some times all together, some times 2-3 at a time, some times, only one errors

On searching on the error this link said that the Error Id meant

"ERROR 7034: NS_E_SOURCEGROUP_NOTPREPARED.This error is due to The source is not yet prepared.%0 .The source of the error code is the Windows Media Server."

On searching for NS_E_SOURCEGROUP_NOTPREPARED , this link confirmed  in part what was said.

But I can find nothing that gives me a root cause of what is causing this error. Which is fair as I wrote the Winservice

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

Convert WCF service to self hosting application


 I created project as a  WCF Service application and now according to recuriment that needs to be converted as a self hosting application

How can i do this?

Converting WCF service app to Self hosting app?

Service Station: Serialization in Windows Communication Foundation


Windows Communication Foundation supports several serialization mechanisms and provides a simple, interoperable foundation for future service-oriented applications. Here Aaron Skonnard explains it all.

Aaron Skonnard

MSDN Magazine August 2006

Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy


Windows services are applications that run outside of any particular user context in Windows NT, Windows 2000, or Windows XP. The creation of services used to require expert coding skills and generally required C or C++. Visual Studio .NET now makes it easy for you to create a Windows service, whether you're writing code in C++, C#, or Visual Basic. You can also write a Windows service in any other language that targets the common language runtime. This article walks you through the creation of a useful Windows service, then demonstrates how to install, test, and debug the service.

Ken Getz

MSDN Magazine December 2001

Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

Getting AppDomain.UnhandledException event to work in a Windows Service

Nearly every forum thread I have found on "catching unhandled exceptions in a service" seems to end up where I am.  The supposed solution is the use of the AppDomain.CurrentDomain.UnhandledException event.  But it doesn't work for someone, who then asks why and gets no answer.  Same for me; I can't get the event to happen.  It's as if I need the ServiceProcess version of Application.SetUnhandledExceptionMode(), which doesn't exist. For diagnosing this, I start a timer in a child object of the service and then throw an exception in the timer event handler.  Simple enough to simulate the real situation.  I have tried subscribing to the UnhandledException event in at least a half dozen locations throughout the service, from the Program that runs ServiceBase.Run() to the constructor of the object that owns the Timer, but it never catches this exception. The VS debugger recognizes that the forced exception is unhandled and takes me to the place where is thrown, letting me know it is an unhandled exception. Why doesn't my handler catch it?  Running without the debugger, the exception throws, the timer thread crashes, the service continues merrily along, and nothing gets logged anywhere.  That is NOT the result I need.  What are the people for whom this works doing that I am not doing? How can I at least get the offe

Windows Identity Foundation Security Token Service can't stay logged in

I'm using the Windows Identity Foundation **(WIF)** Security Token Service **(STS)** to handle authentication for my application which is working all well and good. However I can't seem to get any long running login with the STS. From my understanding I shouldn't care about the client tokens at the application level since they can expire all they want to and it should redirect me to the STS and as long as they're still logged in on the STS it should refresh their application token. Yet it doesn't seem to want to keep them signed in. Here's what occurs in my login.aspx on the STS var cookie = FormsAuthentication.GetAuthCookie(userName, persistTicket); if (persistTicket) cookie.Expires = DateTime.Now.AddDays(14); Response.Cookies.Add(cookie); var returnUrl = Request.QueryString["ReturnUrl"]; Response.Redirect(returnUrl ?? "default.aspx"); Which was taken almost directly from existing application using normal Forms Auth. From my web.config <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="2880" name=".STS" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </auth

Cash Drawer - Method Open threw an exception - Windows Service

Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend