wcf

How can I find a TCP port that is free with NetTcpBinding (WCF) (so a server can bind to it)

Find the next TCP port in .Net says how to do this in raw .net, but not how to safely to this with WCF. In my unit tests, I need to use the NetTcpBinding, I do not wish to hard code the port it is using. Therefore how can I get the NetTcpBinding to automatically choose a free port when used in my ServiceHost? How can I get it to tel...

how wcf works from end-user side not from the programmer view

I am very new to WCF and have nil knowledge about this technology or whatsoever.I just wanted to know how a client will use this. I mean suppose an application has been well-built by programmers.Now coming to deployment, do we need to deploy it on server and again do we need to install something on client machine too for successfully run...

Reusing Types between ADO.NET Data Services and WCF service in Silverlight

I have an ADO.NET Data Service and a regular WCF service. I'm using both these services in a Silverlight application. The WCF sercvice has an operation which has a parameter of the same type as an entity returned by the ADO.NET Data Service. The problem is that silverlight generates different types for the WCF service and for the ADO.NE...

Create a Custom Binding

Hi all, I'm wondering if it is possible to create a custom WCF binding. I want to simulate msmq using a set of database tables to achieve the same principle. There is a lot of negative attention attached to MSMQ at the company where I work due to previous projects that failed attempting to use it. I myself have never had an issue whe...

How do I make Asynchronous calls in WCF with shared contract assemblies?

It is easy to do Asynchronous calls if the client proxy is created with “add service reference”, just call the “BeginMyMethod()” and “EndMyMethod()” calls on the generated client interface. However what you I do when I am used an interface that is defined in shared contract assemblies? E.g. the interface only contains “MyMethod()...

What is the best way to host WCF and ASP.NET together?

I have an asp.net 3.5 site and I've just written some wcf services. It is ok to just drop the .svc file right alongside my .aspx files or should I move my .svc files onto a separate virtual directory and IP and call it something like services.mydomain.com. Just wondering what best practices are. Maybe it doesn't make any difference? ...

Critical error in WCF service

Hello, I am hosting WCF service in console application(just temporary, I will move to service later. Using administrator account). After several hours of execution I get Critical Error from Console(HOST) and my service stop working. What is the best method to trace error? I have tried code below to log error but it seems code do not cat...

How to I use my own interface with OperationContext.Current.GetCallbackChannel?

see also Why do I get InvalidCastException from OperationContext.Current.GetCallbackChannel<>() I wish to pass my own interface to OperationContext.Current.GetCallbackChannel, as I wish to make Asynchronous calls to the client(s) and hence need to add the “BeginMethod()” etc to the interface. I can anexception saying it can’t cast to ...

WCF Services Configuration: How can I access the AppSettings in code using C#

I have googled around and just found reams of pages about how to set up a WCF service config which isn't what I want lol. Basically, I have a factory class within my service which reads a Custom property from the config file to determine which Data Access Object to create, however, whenever I try to test it I get a NullReferenceExceptio...

How do I rename or edit the SVC file of a WCF service in Visual Studio 2010

This one is driving me crazy! I've just upgraded to VS2010 beta 2 and created a simple WCF service. In previous VS versions I could easily find and edit the name and contents of the SVC file from the default Service1.svc to whatever I wanted to (i.e. e.g. MyTestWCFService.svc). I'm trying to do this in VS2010 but; 1) Can't find the svc...

WCF: Cannot find my custom validator specified in web.config - customUserNamePasswordValidatorType - - Could not load file or assembly ... - help?

So I've basically got everything up and running with wsHttpBindings and my WCF service using custom authentication over HTTPS. The issue I'm having is with the customUserNamePasswordValidatorType: <serviceCredentials> <!-- Use our own custom validation --> <userNameAuthentication userNamePasswordValidationMode="Custom" ...

Is there an advantage to using WCF to facilitate AJAX calls ?

I am currently reading through a proposal, where this person is proposing to use WCF services to facilitate AJAX calls in a web application. They say that WCF can serialize data more efficiently. I personally have never considered going this approach. I have always liked calling MVC controllers using jQuery's AJAX functionality, and th...

controlling the name of a named pipe when hosting WCF net.pipe binding in IIS

I have a service accessible via http and net.pipe. It is being hosted in IIS 7 (Server 2008). I may be hosting different instances of this service for several customers on the same machine and hence the HTTP is setup with virtual hostnames etc. This is all working fine. I thought I would do similar for the net named pipe binding - using...

If i dont catch exception on Server side in WCF, will it crash the server side app?

as the title, should i catch exception on server side? ...

WCF call fails because underlying connection was closed

I'm making a call to a WCF service but I get a CommunicationException on the client while receiving the response from the service. System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://localhost:8080/Service. This could be due to the service endpoint binding not using the HTTP prot...

Why do I get InvalidCastException from OperationContext.Current.GetCallbackChannel<>()

So as to enable aysc callbacks to the clients, I need to add the Begin/End methods to the interface that is defined as the CallbackContract on my service. (I am using a sheared contract assembly, rather than generating proxy classes) [ServiceContract(CallbackContract=typeof(IClient)] interface IEngineManager As the first step I have ...

Wcf isolated instances

Hello, I am new to Wcf and tried to create my first Wcf services. Added class(new assembly) which has unmanaged code and do file manipulation. Service behavior is set as follow InstanceContextMode = InstanceContextMode.Single ConcurrencyMode = ConcurrencyMode.Single When service is accessed is single mode, the new file manipulation c...

WCF Trace and Performance

Hi, I just wonder is there is sensible explanaition to such an issue: I have turned on trace on WCF Console host. When I analyze that trace, I can see that individual activities duration is maximum 4 seconds On client application I have made simple duration mesurement (before and after call to WCF service). Here results are much bigge...

referencing a WCF web service

Our current project uses an asmx service. We want to keep this service for now, but would like to add an additional wcf service for ajax calls. I followed a procedure i found online to set up the service and it works fine with javascript in aspx files within that particular project but i'm unsure how to reference it in javascript files ...

WCF Error Handling without fault contract

I have a WCF service which all operations return type is OperationStatus: [DataContract] public abstract class ServiceResponse { [DataMember] public bool Success { get; set; } [DataMember] public String StatusReason { get; set; } } I'd like to create an ErrorHandler to catch all exceptions and then I'd like it to ret...