0

I was trying to use the autofac with WCF Integration. I was using the solution from https://code.msdn.microsoft.com/DI-with-WCF-using-Autofac-a3e8cbbb. I am able to consume the service and call the operations by adding a service reference.But when I am trying to use WCF Test client or SOAP UI its not giving the response.In WCF test client it was giving the exception -

System.InvalidOperationException: The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host.

I tried adding the paramterless constructor for the service but after that it was giving another exception while invoking the service -

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)

halfer
  • 19,824
  • 17
  • 99
  • 186
Vishnu
  • 897
  • 6
  • 13
  • Did you try with the official documentation : http://docs.autofac.org/en/latest/integration/wcf.html ? – Cyril Durand Nov 13 '15 at 14:30
  • Yes, infact the solution that i mentioned above satisfies all the things mentioned in official documentation. – Vishnu Nov 13 '15 at 15:29
  • Without *any* code, we will not be able to help you. Can you show your `.svc` file? – nvoigt Nov 13 '15 at 15:56
  • I was infact using the sample solution from https://code.msdn.microsoft.com/DI-with-WCF-using-Autofac-a3e8cbbb – Vishnu Nov 13 '15 at 16:24
  • 1
    From the error message it seems like its not using autofac service host factory, please help if anyone has already deal with such an issue before – Vishnu Nov 13 '15 at 18:37
  • Did you verify the content of your "CarProviderService.svc" (Name according to the msdn sample) <%@ ServiceHost Language="C#" Debug="true" Service="Ioc.Services.ICarProviderService, Ioc.Services" Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf" %> http://docs.autofac.org/en/latest/integration/wcf.html#register-service-implementations – flo scheiwiller Nov 16 '15 at 16:07

0 Answers0