WCF configuration for IIS ServiceHost

279 views
Skip to first unread message

Keith

unread,
Oct 29, 2010, 8:47:50 AM10/29/10
to Autofac
Hi,

I'm using Autofac on my WCF web server and it works great for normal
requests that do not take over a minute. However, some of our requests
take longer and are very large. This led me to add some WCF config to
my web.config, but it doesn't seem to be picked up.

Here is my web.config:
<system.serviceModel>
<!--aspNetCompatibility required for file-less endpoints-->
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"
aspNetCompatibilityEnabled="true"/>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" />
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>

<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="67108864"
sendTimeout="00:03:00"
receiveTimeout="00:03:00"
transactionFlow="true">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>

And these are my relevant registrations:

var builder = new ContainerBuilder();

// Register the WCF Services

builder.RegisterAssemblyTypes(Assembly.GetAssembly(typeof(ServiceAuthority)))
.InNamespace("xxx")
.AsSelf()
.AsImplementedInterfaces();

AutofacServiceHostFactory.Container = builder.Build();

Am I missing something here? How can I make my WCF services honor the
3:00 timeout?

tillig

unread,
Nov 1, 2010, 12:37:21 PM11/1/10
to Autofac
For the sake of experimentation, try naming your service configuration
with the name of the implementation type, like:

<system.serviceModel>
<services>
<service name="MyNamespace.MyServiceImpl" ... />
</services>
</system.serviceModel>

...rather than doing the nameless/default config thing. I found that I
was able to get that working in one specific instance a while ago.

I'm not sure if that's the desired solution to the issue or if there's
a defect in how Autofac is doing the service hosting that ignores the
default/nameless configuration settings. Might be something to step
into.

Issue 222 (http://code.google.com/p/autofac/issues/detail?id=222) has
been filed to allow a better extensibility/flexibility for WCF
hosting. It may tie into this. That issue would at least allow you to
programmatically do this configuration. Currently there is no way to
programmatically configure the Autofac service host.

Alternatively, you could try the AutofacContrib.Multitenant service
host. I implemented some extensibility there that would allow you to
either specify a metadata buddy class for your service interface so
you could control these things or subscribe to an event that would let
you attach behaviors, etc., to the service host.

If you can't get the default/nameless config to work, it might be an
idea to file an issue on the site:
http://code.google.com/p/autofac/issues/list

-T
Reply all
Reply to author
Forward
0 new messages