.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

Create an exchange interface to call a Windows Service with WCF

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :WCF

I'm develpong an application that consists on a Client that communicates with a Windows Service via WCF.
I have three projects defined: MyClient, MyService, MyExchangeClasses

The first two are easy to understand, client and server. The MyExchangeClasses project contains the interface for MyService remote function calls and contains the implementation of those classes that are passed via parameter o are returned by the remote functions that implement the interface I've already mentioned.

For example I have one remote funciton defined in the interface like this:

public interface IService1
   IEnumerable<MyObject> GetAllMyObjects();

And MyObject is defined like this:

public class MyObject    
    public String Name { get; set; }

So in order to make it work MyExchangeClasses needs to be referenced in both MyClient and MyService classes.

View Complete Post

More Related Resource Links

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 crashing on call to unmanaged code, even though console app version works


I have a C# program that at some point calls 2 functions from an unmanaged dll using p/invoke.  Everything works fine when I'm running in a console app.  When I compile the same program as a windows service and run it, it crashes.  The console app and service should be identical as far as my code is concerned... all either program does is create an object from another assembly of mine and run a Start() method on it.

I have used VS2010 to debug the managed and unmanaged code, and when I step through the Console app everything looks great.  When I attach the debugger to the service, i can step through the first function in the unmanaged code, control returns to the managed code, and then later when it comes to the point where it calls the second unmanaged function, the process terminates immediately before the debugger steps into the first line of unmanaged code.  There are no exceptions that I can see, and the only thing written to the event log is the generic "service terminated unexpectedly" message.  Running "sc query" on the command line lets me know the win32_exit_code is 1067.

Im running everything in .net 4, on winxp 32bit.  The serivce is running as Local System ideally, but the same behavior exists when I run it under my user account. 

How to create a WCF web service using TCP protocol hosted on windows services and compatible with no



I need to create a WCF web service . My service will operate on LAN hence I wish to use TCP protocol for that.

So I need to host that web service on windows service.

But I don't know how to make that web service compatible with other platforms.

I wish my service should be platform independent.

If anybody knows the solution then pls let me knw.

Unable to call WCF Service (svc) from .NET Windows Service



 I have an odd problem. I created a windows service and in it I created a reference to my wcf service which is hosted in IIS. I generated the proxyclient for async operations.

When I tried calling it in my development machine it didnt throw any error but it also didnt invoke the wcf service. After a lot of permutations I changed the user account of the windows service to "Network Service" instead of "Local System" and it started working.


Now i have deployed the same to Windows 2003 server. I have again landed up with the same issue. I did change it to Network account but no use. I am not too sure whats the problem as no errors are being thrown nor is it showing any errors in debug mode.

Any thoughts on this pls?

Thanks & Regards



Web service call fails on Windows 7


I have a Windows application written in C# using .NET 2.0 and Visual Studio 2005. I develop on a Windows XP machine. The application makes web service calls over SSL. To support SSL, I have to install WSE 3.0 on the development machine.

When I run my app on an XP machine it works perfectly and makes web service calls to an SSL enabled web service after I set the following registry entry to a non-zero value:

DWORD Value = zero Value = nonzero
UseScsvForTls  Client sends Renego Info extension for TLS  protocol  Client sends SCSV for TLS  protocol



The problem occurs when I run the app on a Windows 7 machine. The web service call fails with the following error:


The underlying connection was closed: An unexpected error occurred on a send.-   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)

   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)

   at Mic

Connection times out when WCF client tries to call WCF service, both in Windows Forms apps



The exception message is: Could not connect to TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

What I am trying to do: a WCF service is self hosted in a Windows Forms application. The WCF client is in another Windows Forms application. Eventually, the client is supposed to run on a computer somewhere out there on the Internet and send messages to the server which is running on my home computer. This is my first attempt at making a remote WCF call.

I have success when server and client either run on the same computer, or are running on different computers attached to my little in-home LAN. When I try to route the client's request via Internet (in preparation for having the client reside out there somewhere) I get the exception reproduced in the first paragraph above after waiting for about 20 seconds.

OS is WinXP Pro with SP3. Using Visual Studio 2008, Visual Basic. is the IP currently assigned to me by Comcast (I watch carefully to see when it changes; also, I altered it for purposes of asking this question).


How to call Windows service from another Application



I have Created one  Windows Service using ATL and COM,How to call this Service from My application which is also in ATL and COM.

Please help me.

How to get user to create a folder from a Windows service


Good afternoon everyone,

The question is very simple. I created a Windows service with c # 

When I use interface as Contract in Web.config, I cannot call the service


I tried to use interface to define services but the JavaScript function will fail.  Without the interface, everything works perfectly.  Consider the following.

Consider the following.


namespace Enroll.ER.Services {
 [ServiceContract(Namespace = "Enroll.WebServices")] 
 interface IAccountService {
 bool Checkin(string acctKey);

namespace Enroll.ER.Services {
 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
 public class AccountService : Enroll.ER.Services.IAccountService {
 public bool Checkin(string acctKey); {

 public class MyFaultException {
 public string Reason { get; set; }

Web service call fails on windows 7 with LSP



I am facing connectivity issue from windows 7 client developed in dotnet 2.0 to a webservice which is developed in dotnet 2.0 and hosted in windows 2003 server. The error I am getting is,

"Error Message: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section."

For a specific functionality, the client has to function with Layered Service Provider (LSP)
This LSP will be automatically installed in the windows 7 client while installing the Agent kit. I suspect the issue is because of LSP .


Client (Windows 7)   :

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.

How to create a windows mobile (Smart Device) .Cab installer

A Cab file is the default setup format for Windows CE and Windows Mobile devices (similar to windows .msi files). You probably already have installed several application using .cab files, and are familiar with the concept. One point which is often unknown is that .cab files are processed by wceloader.exe, and it can only install one .cab file at a time. That means we cannot have nested .cab files. It doesn't mean we cannot have .cab files contained by another .cab, but the contained .cab files will not be installed during the installation of the container .cab. We should install it manually after the container .cab file installation has been completed.

There are two ways to create a cabinet (.Cab) file. The traditional one, and the friendly VS Smart Device Cab project which doesn't require additional coding, but which also relies on the traditional one at low-level.

Fuzz Testing: Create a Custom Test Interface Provider for Team System


Dan Griffin shows the extensibility of Visual Studio 2005 Team Edition for Software Testers by discussing the modification of the existing Test Interface Provider sample in the latest Visual Studio SDK and implements Fuzz Testing.

Dan Griffin

MSDN Magazine November 2007

Desktop Security: Create Custom Login Experiences With Credential Providers For Windows Vista


Why is a change to the Windows logon plug-in interface so exciting? Because with credential providers you can customize the logon experience for your users.

Dan Griffin

MSDN Magazine January 2007

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

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