.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

Windows service for WCF Stops

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :ASP.Net

   I have a WCF application hosted as a windows service. This windows service triggers this WCF every 15 minutes. But when an exception occurs in this WCF the service is getting stopped.
I don't want this service to stop. I want to some how handle this exception and trigger this WCF after another 15 minutes.
How can i do that? Please help, its urgent.


   I have a WCF application hosted as a windows service. This windows service triggers this WCF every 15 minutes. But when an exception occurs in this WCF the service is getting stopped.

View Complete Post

More Related Resource Links

Windows Service Suddenly Stops with no logged message

Background: I have a windows service which hosts some wcf services and multithreading has been used there heavily. I'm using Enterprise Library to log messages, handled and unhandled.  AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;  private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)         {             Logger.Error("An unhandled exception has been thrown.", (Exception)e.ExceptionObject);         } Problem: The problem is that randomly my windows service stops on production and I get no log messages saying that the services stopped or what exception details. Question: I haven't created any new AppDomain explicitly. Shouldn't all the threads run in the same default CurrentDomain? if so, why nothing gets logged when the service stops suddenly? Thanks in advance.    

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.

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

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

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

How can I debug Windows Service using Visual Studio?

How can I debug Windows Service using Visual Studio? I wrote in Visual Studio 2008 Command Promt: installutil -i c:\projects\MyProject\bin\debug\win.exe I did Start to may service ,but every time that I want to debug service I get: Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.   What am I doing wrong?   Thanks, Raya        

logoff doesn't work through windows service

Dear Friends, I am facing this problem on Windows 2003 and 2008 Server. On XP it works fine. I have written and Windows Service that takes receives the command and executes tasks such as Logoff, Shutdown, etc. All the commands except Logoff works fine. I tried following ways to perform the Logoff. However it didnt work. Try 1:                 Process.Start("shutdown", "-l"); Try 2:     [DllImport("user32.dll")]     public static extern int ExitWindowsEx(int uFlags, int dwReason);     ExitWindowsEx(0, 0); Try 3:     Process _currentProcess = new Process();                _currentProcess.StartInfo = new ProcessStartInfo("shutdown", "-l -f");                _currentProcess.StartInfo.UseShellExecute = false;                 _currentProcess.Start(); Try 4:     Process.Start("logoff.exe", null); If I write a simple C# based applicatin (not Service) it works fine for all the tries that I have made. I am facing this problem only when I put this code

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

Question about WCF Service hosted in Windows Service

Hi, I have little experience with WCF and working on a projet that requires WCF Service instance to run 24x7. After searching for a solution and reading about WCF, I think if I host it under Windows Service I can have a single instance of WCF Service running 24x7. Is this correct? I just successfully ran the MSDN sample project that hosts CalculatorService in Windows Service. I realized that Windows Service cannot communicate with WCF Service it is hosting (I do not have any experience with writing Windows Service). I wrote a test function (public) in Windows Service and tried to call it from WCF Service but it did not appear in the Intellisense list. Is my assumption correct or is there a way to establish communication between Windows Service and its hosted WCF Service? Thanks. kr

Unable to call an asmx web service using windows authentication from a Service workflow

Hello, I need to use an existing asmx service from inside my service workflow and I am unable to call it. This asmx service is hosted in a web application with iis set to windows authentication, anonymous is not allowed. I need to send the authentication, only way seems too be using transport for basicHttpBindings. Every time I try to call the service I get an error saying that there is nothing listening to the url of the service generated automatically by VS when I added the Service Reference ? my web config <configuration> <configSections> </configSections> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <protocolMapping> <add scheme="http" binding="wsHttpBinding" bindingConfiguration="WindowsCreds" /> </protocolMapping> <bindings> <basicHttpBinding> <binding name="UtilitiesSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

Windows service can't use Reporting Services on SQL Service 2008 R2

Hello. I have a Windows service that run as Local System account. The service uses the Reporting Services ReportService2005.asmx web service. When I have SQL Server 2008 installed, I have no problems and my service is able to browse and create report. After I have installed SQL Server 2008 R2 I get the error "The request failed with HTTP status 401: Unauthorized." when the service tries to use the web service. If I change my service to log on as a user with administrator rights, it is able to use Reposting Services again. What has changes in SQL Server 2008 R2, that doesn't allow the Local System account to use Repoting Services? And is it possible to configure Reporting Services to allow it?   - Per

WCF Service stops after throwing a unhandled exception :no user is logged on.

Hi All,       I have written a WCF service which is hosted as a Managed windows service. I consume this service in a web application. The service is built using a httpBasicBinding and security Mode ="none". I'm now getting the following exception, after which the service stops  "An unhandled exception ('System.ComponentModel.Win32Exception') occurred in CMMonitorService.exe [1812]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on." I had tried changing the security mode to Transport/Message. with windows credential then I get a access to the path denied error. Can anyone provide hint on what am I missing and what would be the appropriate security mode and client credential to use along with basichttpBinding?

Best Practice for Windows Service "Settings" (Configuration) with .Net (C#) ???

Background:   I'm developing a Windows service using C# and .Net 3.5.  The behavior of the service should be controlled by some settings.  The settings will vary per host-computer but will not vary per user (which should be understandable since the settings control behavior of a service.)  A GUI panel of sorts must be provided to set-up and modify the settings that control the service behavior.Secondly, there is a "locally installed application" that has its own settings and those settings also vary per host-computer so all users of that computer would experience the same settings.  (Seemingly analogous maybe to a connection string but not a connection string.)Note that I do NOT perceive any need for Click-once support, web support, and so forth.  Translation:  I think I need the simplest darn type of settings support, the old "dinosaur" level of requirements not much more sophisticated than INI files used to be. I've researched using the "built-in" settings that make use of the Settings Visual Designer in VS 2008 and  System.Configuration.ApplicationSettingsBase.  It seems that: 1.  Application Settings cannot be changed at runtime.  MSFT documentation indicates the software must be shut down and settings must be modified by patching the XML with a text editor (notepad et al.)  The framework specifically prohibits application settings from being

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.
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