Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServiceHostFactory.CreateServiceHost is called multiple time WCF

Tags:

iis

wcf

I have a wcf service which hosted at IIS

<%@ ServiceHost Language="C#" Debug="true" Service="MyService" Factory="InitializableServiceHostFactory" %>

my problem is that the CreateServiceHost is called with each request to MyService method, which make my initialization code which is written in CreateServiceHost is called multiply.

like image 287
Niklaus Wirth Avatar asked May 15 '13 13:05

Niklaus Wirth


1 Answers

After I checked a lot about this problem, I saw that it is related to ASP.NET dynamic compile, it is recompile the whole site when any things inside Bin folder is changed, but my WCF service writes to the temp folder inside Bin folder which make the site recompiled then the Application_Start re-fired, then the InitializableServiceHostFactory re-create the WCF service

I know it is a dummy problem :(

like image 117
Niklaus Wirth Avatar answered Nov 15 '22 04:11

Niklaus Wirth