1

We're seeing this error in a customer environment with our WCF services.

We haven't been able to reproduce in house with the same Dlls and web.config settings. Therefore, I'm assuming it's an issue with the environment.

Any suggestions for things to check on the server?

This is the error we're seeing when browsing to any of the .svc files:

[InvalidOperationException: The AutofacServiceHost.Container static property must be set before services can be instantiated.]
Autofac.Integration.Wcf.AutofacHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +478
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1429
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598

Ben
  • 21
  • 3
  • can you post your global.asax file and your web.config ? – hugo Jun 23 '17 at 13:54
  • At some times global.asax is not working. It may be a misconfiguration of IIS as well. Just as a safer precaution it makes sense puting init code into static constructor of `MyHostFactory : AutofacHostFactory` – Anton Krouglov Jul 06 '17 at 22:52

1 Answers1

1

Solved. The customer environment was missing the global.asax file. :(

Ben
  • 21
  • 3