How to create a web.config file to get SoapExtension loading?

℡╲_俬逩灬. 提交于 2019-12-01 17:15:12

I found out how to (or indeed 'where to') insert the web.config content in the app.config file:

I had to insert it after 'ApplicationSettings' and 'userSettings' ; this is the only place where it doesnt generate any error at runtime (So no need for a web.config file - though i still would like to know how to configure the app, if someone has the answer...).

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
    </configSections>
    <applicationSettings>
    </applicationSettings>
    <userSettings>
    </userSettings>
    <system.web>
        <webServices>
          <soapExtensionTypes>
            <add type="MyNameSpace.MySoapExtension,MyAssemblyFileName" priority="1"/>
          </soapExtensionTypes>
        </webServices>
    </system.web>
    <system.serviceModel>
        <bindings />
        <client />
    </system.serviceModel>
</configuration>

My SoapExtension seems to be correctly initialized now, the message filtering works fine.

Related to @soleshoe's comment I couldn't get my Unit tests (XUnit) to work, my App.config looked like this in the end.

 <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
  </configSections>
  <system.web>
    <webServices>
      <soapExtensionTypes>
        <add type="System.Common.SOAPExtensions.TraceExtension, System.Common"  priority="1"/>
      </soapExtensionTypes>
    </webServices>
  </system.web>
</configuration>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!