asp.net - Cannot access Elmah error log when using wcf -
i've been trying use elmah wcf , have added "normal" errorhandler
, serviceerrorbehavior
service. these work, can see when there exception code in these runs , logs error elmah. should fine when try access error log page elmah.axd
http 404 , wcf gives me "endpoint not found page".
which means elmah.errorlogpagefactory
not used on url. comes down web.config
(i think). can't right, here relevant parts of web.config
:
my service endpoints setup so:
<system.servicemodel> <standardendpoints> <webhttpendpoint> <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true" /> </webhttpendpoint> </standardendpoints> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" /> <services> <service name="saraservice.saraservice" behaviorconfiguration="sarasvcbehaviour" > <endpoint name="saraservice" address="" binding="webhttpbinding" bindingconfiguration="webhttpbindingwithjsonp" behaviorconfiguration="restendpointbehaviour" contract="saraservice.isaraservice" /> <endpoint address="soap" behaviorconfiguration="soapendpoinstbehaviour" binding="basichttpbinding" contract="saraservice.isaraservice" /> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="sarasvcbehaviour"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="restendpointbehaviour"> <webhttp /> </behavior> <behavior name="soapendpoinstbehaviour"> </behavior> </endpointbehaviors> </behaviors> <bindings> <webhttpbinding> <binding name="webhttpbindingwithjsonp" crossdomainscriptaccessenabled="true"> </binding> </webhttpbinding> </bindings> </system.servicemodel>
so there endpoints in / , /soap urls.
and elmah config this:
<system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5" /> <httpmodules> <add name="errorlog" type="elmah.errorlogmodule, elmah" /> <add name="errormail" type="elmah.errormailmodule, elmah" /> <add name="errorfilter" type="elmah.errorfiltermodule, elmah" /> </httpmodules>
</system.web> </location> <system.webserver> <handlers> <add name="elmah" verb="post,get,head" path="elmah.axd" type="elmah.errorlogpagefactory, elmah" precondition="integratedmode" /> </handlers> </system.webserver>
and i'm running autofacservicehostfactory
in root url. here global.asax.cs relevant parts:
public class global : system.web.httpapplication { protected void application_start(object sender, eventargs e) { var builder = new containerbuilder(); builder.registertype<saraservice>(); builder.registertype<markkinadataaccess.markkinadataentities>().instanceperlifetimescope(); builder.registertype<generisdbconnectionsettings>().as<igenerisdbconnectionsetting>().singleinstance(); builder.registertype<generisapplication>().as<igenerisapplication>().propertiesautowired().instanceperlifetimescope(); builder.registertype<crmproductsquery>().as<icrmproductsquery>(); builder.registertype <productsbynamequery>().as<iproductsbynamequery>(); builder.registertype<productmwquerybyname>().as<iproductmwquerybyname>(); builder.registertype<productmwquerybyid>().as<iproductmwquerybyid>(); autofachostfactory.container = builder.build(); routetable.routes.add(new serviceroute("", new autofacservicehostfactory(), typeof(saraservice))); } }
so guess either running service endpoint in root or autofacservicehostfactory
somehow prevents me accessing elmah log page in /elmah.axd url.
but don't understand why or how.
in case, appreciated.
ok, got (partially @ least). culprit line in global.asax:
routetable.routes.add(new serviceroute("", new autofacservicehostfactory(), typeof(saraservice)));
so make service endpoint root wanted.
also wanted route (any route other root) access elmah error log page. of course means there has route handler runs elmah.errorlogpagefactory.
now should simple when add service root url seems cannot access route handler (axd) no matter what.
this seems odd me because can create file example in www/index.html , served fine without touching web.config @ all. in case of "generated" route elmah.axd or www/elmah.axd service added in root url executed. giving me "no endpoint" page wcf pipelines http 404.
in case, if put service url other root can access elmah error log.
and yes, did try ignoring elmah.axd url gave me normal 404 error.
so guess i'll have put service place other root unless can come better answer this.
Comments
Post a Comment