JoeGeeky
JoeGeeky

Reputation: 3796

WCF PerSesson InstanceContextMode prevents generation of proxies using SVCUtil

I have a Windows Service hosted WCF Web Service. I've been generating proxies using SVCUTIL and things have been working fine, but today I changed the InstanceContextMode from InstanceContextMode.Single to InstanceContextMode.PerSession and now I get the below error which I can't isolate. I can reliably recreate the error by changing nothing other then this one setting. Any ideas???

Here is the Error Message from SVCUTIL

Generating metadata files... EXEC : error : There was an error exporting the service type: Host.Services.MyService.

An exception was thrown in a call to a WSDL export extension:

System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://MySoftware/ServiceContracts/2011/02:IMyService

The service interface is as follows:

[ServiceContract(Namespace = Namespace.Current, SessionMode = SessionMode.Allowed)]
public interface IMyService

The service implementation is now configured as follows:

[ServiceBehavior(Namespace = Namespace.Current, InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService

Here is the current setting in my config file for the data contract serializer

<dataContractSerializer maxItemsInObjectGraph="1000000" />

Upvotes: 0

Views: 254

Answers (1)

IdoFlatow
IdoFlatow

Reputation: 1438

This doesn't seem to be related to the instance context mode.
Try the following:

  1. Use an HTTP sniffer, such as fiddler, to see the returned WSDL file. Make sure you are not getting an error page instead of the wsdl file.
  2. If you are getting a WSDL file and not an error page, save that file, change the service back to single, get the WSDL and compare the two WSDL files to find the problem.

Upvotes: 2

Related Questions