.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

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

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


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.

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

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

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

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

Moving part of the code/processing from Asp.net hosted in IIS to WCF-Windows Services will help to r

I have a web application with no user interface (GUI), this web application (asp.net) accepts some input from a program and doing some processing; In the Page Load event I am doing all processing and calling a WCF service, after receiving the response from WCF services the page get unload before writing the processing status/result to database) this asp.net application is hosted in IIS.   The WCF services is also hosted in the same machine in windows Services where IIS is hosted, I am concern about its performance of the application which is hosted in IIS.  Should I move some part of the code (processing) to another program say Create a new WCF Services and host it in Windows Services  so that the load on IIS will be reduce?  The new WCF Services will process some part of the code which IIS used to process, so helping IIS to reduce the load.       By moving some part of code from asp.net [processing] to another program hosted in WCF- Windows Services in same machine will able to reduce the load on IIS?   Please guide me.. Thanks Shaju

How to use single windows service to host multiple WCF Services instances (Each instance of WCF is i

How to use single windows service to host multiple WCF Services. I have a mutiple instance of same WCF service in different folder, each instance has unique service name and port. WCFService has reference to Reg-Free COM Reference, i have Native.WCFService.manifest in each folder. Ex: WCFService1 is in "C:\WCFService01\WCFService.dll, Native.OCWCFService.manifest, OCWCFService.dll.config WCFService2 is in "C:\WCFService02\WCFService.dll, Native.OCWCFService.manifest, OCWCFService.dll.config Now i need host above services from single Windows Service. I am trying to create AppDomain for each above WCFService Instance from Windows Service and then host. Its working if i register COM dll in the server using regsvr32, but when i un register COM dll, i am getting unable to load COM component .... This looks like AppDomain is not loading COM DLL and Manifest files. Its looks strange but we need it in this way because we have production and test environment in the same server. Everything works fine if create a seperate Windows Service for each WCFService Instance, but my manager wants single Windows Service :). Any help whould be really appreciated.  ravi kumar reddy

the list cannot be imported because a windows sharepoint service-compatible spreadsheet application

I have googled this for 3 days now, without any solution. I have install, reinstall services and ms office, save as web the excel file for import, without any results, have anyone encounter this error. I need help.

WCF hosted in a Windows Service, how to make calls to the WCF service from within the service host


I have a Windows service that I converted to a WCF service that I want to host in a Windows Service.  I need to do some specific tasks in the OnStart() and OnStop() just like I did when it was just a Windows service.  My original Windows service OnStart() is where I create the main worker thread.  So how do I make a call into my WCF service from within the hosting service? For example in the hosting service's OnStart() I do a host.Open() then I need to call a method in my WCF service but how?



ServiceHost host =

TCP Error Code 10060 when attempting to access WCF Service hosted by WIndows Service from client run


Hello all,

We have a Framework 3.5 WCF Service which is in turn hosted in a Windows Service using Net.Tcp Binding. SvcUtil is used to generate the proxy which is used instead of a service reference in the client code. We are also using Tcp Port Sharing. The endpoint address is net.tcp://HostMachineName/MyServicePath. The service logs to the Event log and everything works perfectly on the same machine.

When attempting to run the client from a different machine we are getting TCP Error Code 10060 errors. Below is the error message:

System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://HostMachineName/MyServicePath. The connection attempt lasted for a time span of 00:00:20.8592415. 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 111.22.333.444:808.  ---> System.Net.Sockets.SocketException: 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 111.22.333.444:808... The IP Address displayed was the correct IP Address for the HostComputerName.

Has anyone encountered this problem? Also, client specs say no config files, so anything that wo

Create an exchange interface to call a Windows Service with 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.

How to create a "Contracted Services" Dimension - the intersection of Customer, Contract and Service


Can some give me some guidance on how to create a 'Contracted Services' Dimension?

I have the following working Dimensions:

Customers and Services

And a Fact_Service_Usage. Fact_Service_Usage has a CustomerKey and a ServiceKey. This creates a proper intersection of Services_Usage, Customer and Service.

However, in our business we need to ensure we only report on 'Contracted Services'.

So I need to create a Dimension that properly enumerates only those services for which the Customer is contracted. I have a table called DimContractedServices that holds the CustomerKey and the ServiceKey for those services for which they are contracted.

In the Data Source View I create the relationships between the respective Keys and use the Dimension Building Wizard to create the Contracted Services Dimension.

This Dimension is not working correctly.

Could someone help walk me through an example of how they would approach building this ContractedServices Dimension correctly? Perhaps someone has built a similar Dimension and can give me some hints on how to structure this so that it allows the enumeration of the .MEMBERS for only ContractedServices.

Thanks very much for the assistance.




nettcpbinding with windows security in iis hosted service


Hi ,

I have hosted service in iis. How can i verify my service (transport mode)is using windows authentication for client.

when i use basichttpbinding and set clientCredentialType to windows, but iis with anonymous. When i browse svc, as expected i get error that secrurity setting of servcie needs windows but iis is configured as anonymous. Similar i see expected bheavior when service is configred for anonymous, but iis is configured for windows.

But when i use nettcpbiding, irrespective of what my iis setting is (windows/anonymous), if i configure service for windows and i browse svc file. I am always able to do to without any error. when service is configured for windows and iis for anonymous; shouldn't i get an error (as seen in case of basichttpbinding)



How to debug Windows Workflow when it is hosted by WCF Service ?



I have build a test solution in two parts :

1) WCF service which hosts a Windows Workflow (statemachine).

2) Console application which consumes the WCF Service.

It works well, but if I do a bad process, it crashes which is normal. Exemple : the client calls an event which is impossible to execute given the current state according to the workflow design. In this case, the client receives a WCF exception. This exception is masked, which is normal (an option has to be set in WCF side to enable exception transmission).

The problem is that, althought I launched the console application with the debugger, with the WCF service project, the debugger doesn't break on Workflow errors in WCF error side. (However, I saw that non-Workflow errors in WCF side are still stopped by the debugger)

How could I force the VS debugger to break on Workflow WCF errors ?


(Workflow 3.5)

How to enable windows authentication for a RESTFul web service which is not hosted in IIS


I have created a WCF RESTFul webservice by following http://msdn.microsoft.com/en-us/library/dd203052.aspx. I am hosting my RESTful webservice in a window service (and not IIS) using the WebServiceHost class. 

Now I am struggling to get user's windows credentials in my web service methods. I looked at various code samples in forums for this. Almost all of them are hosting the service in IIS plus configuring  the service's settings using <system.serviceModel> tag.

I don't want to host my service in IIS plus as of now I haven't overridden any EndPoints, Behaviours etc in .config file.

I tried with below code in my window service's onstart method

WebServiceHost host = new WebServiceHost(typeof(MyService), new Uri(_serviceUrl));

ServiceAuthorizationBehavior myServiceBehavior = host.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.UseWindowsGroups;


After putting above code I queried ServiceSecurityContext.Current and System.Threading.Thread.CurrentPrincipal  my RESTFul's method but they are showing no sign of return

WCF service hosted in a Windows Service Automatically Starting


I stop the Windows service that hosts the WCF application, it stops, then it starts back up. Service recovery options are disabled.


It is somehow starting itself back up…   Any ideas as to why?

Kevin Burton

"Windows SharePoint Services Web Application" service is showing 'Error starting'.


I just installed MOSS SP2 and ran the config wizard on the server.
I am facing issue with our farm. Found that "Windows SharePoint Services Web Application" is in a problem.

I tried below commands:-
stsadm -o provisionservice -action stop -servicetype spwebservice -servicename ""
stsadm -o provisionservice -action start -servicetype spwebservice -servicename ""
But getting error:- Provision of service failed. Additional information: 1387.

Checked eventvwr and found below error log:-
Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Topology
Event ID: 7034
Date:  10/21/2010
Time:  5:16:10 AM
User:  N/A
Computer: <Servername>
An attempt to start/stop instance  of service Windows SharePoint Services Web Application on server <servername> did not succeed. Re-run the action via UI or command line on the specified server.

None of the sites are working and I cannot see anything in the IIS folder nor in the IIS manager. All application folders are missing. But, I can see all the sites & Content databasesin the Central Admin.

Can someone please help?


MSMQ Recieve Activty fails in workflow hosted in Windows Service



I am trying to implement a windows service hosted workflow service that polls from a message queue. The message queue is is populated by a separate windows service.

I followed the post below for my hosted workflow as it looked to be close to what I was trying to do.


Following the steps in the post I was able to get my service to work when the message body was a simple string and using the WCFTestClient.

I then changed the code to use a a custom .NET object as the Recieve parameter instead of the string. The class library in which the object is defined was added as a reference. The service that populates my queue uses the custom .NET object as the message body.

In this scenario, the service would run but only process a message from the queue if it was in the queue before the service started. Any new messages added are ignored and if I add the message after I start the queue it also does not get picked up.

My xamlx is below, followed by my app.config:


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