Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To solve this. I removed the reference to the autofac AutofacServiceHostFactory in the config. Then I wrote endpoints manually with behaviors. </p> <p>I used AutofacServiceHostFactory in the .svc file for the service.</p> <p>This was not the way I'd prefer to do it but otherwise I didn't both the rest endpoint and the basichttp soap endpoint to work.</p> <p>If someone has a better solution, I'll give you the answer.</p> <hr> <p>@John Meyer Upon request for my code sample, I managed to find some old code.</p> <p>The service like EmailService.svc in my folder Services, edit like so:</p> <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="Services.IEmailService, Services" Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf" %&gt; </code></pre> <p>in web.config</p> <pre><code>&lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;dependentAssembly&gt; &lt;assemblyIdentity name="Autofac" publicKeyToken="x" culture="neutral" /&gt; &lt;bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" /&gt; &lt;/dependentAssembly&gt; &lt;dependentAssembly&gt; </code></pre> <p>AppStart class</p> <pre><code>public static class AppStart { public static void AppInitialize() { IContainer container = AutofacContainerBuilder.BuildContainer(); AutofacHostFactory.Container = container;} } ... </code></pre> <p>I seperated the container to another class. Dont forget the correct using using Autofac;</p> <p>and the method in the class to set up the container</p> <pre><code>public static IContainer BuildContainer() { var builder = new ContainerBuilder(); builder.RegisterType&lt;EmailService&gt;().As&lt;IEmailService&gt;(); return builder.Build(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload