How can I have any uncaught exception get returned as a SOAP fault in my C# web service? It appears that IIS is ‘catching’ the exception and displaying it on the default error. Below is santized web.config.
<?xml version='1.0'?> <configuration> <configSections> <section name='hibernate-configuration' type='NHibernate.Cfg.ConfigurationSectionHandler, NHibernate' /> </configSections> <system.web> <httpRuntime enableVersionHeader='false' /> <sessionState mode='Off' /> <compilation defaultLanguage='c#' debug='true' /> <authentication mode='None' /> <customErrors mode='RemoteOnly' defaultRedirect='GenericErrorPage.htm'> <error statusCode='403' redirect='NoAccess.htm' /> <error statusCode='404' redirect='FileNotFound.htm' /> </customErrors> <webServices> <protocols> <remove name='HttpPost'/> <remove name='HttpGet'/> <remove name='Documentation'/> <remove name='HttpSoap12' /> </protocols> </webServices> </system.web> </configuration>
it turns out some bad logic in an HttpModule was causing the application to error out. once this was resolved the application behaved as expected.