0

I get the error Config section 'System.web/httpRuntime' already defined when I deploy our application to our development environment.

After deploying, if I push the Authentication button on the IIS servers management overview, I get the following error message:

IIS server error message

The Web.Config on the IIS has the <system.web> element looking like this:

<system.web>
    <compilation targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="None" />
    <authorization>
        <deny users="?" />
    </authorization>
    <httpRuntime requestValidationMode="4.5" />
</system.web>

The problem is clearly that somehow both <httpRuntime targetFramework="4.5" /> and <httpRuntime requestValidationMode="4.5" /> are being added to <system.web>. My problem is that I can not figure out how the <httpruntime> tag is being added to my Web.Config when deployed to our development environment. It does not happen on my local machine. We use Octopus Deploy as deployment tool (I'm not sure if that matters).

The Web.Config <system.web> in the project looks like this

<system.web>
  <compilation debug="true" targetFramework="4.5.2"/>
</system.web>

and the Web.Release.Config <system.web>looks like this

 <system.web>
  <compilation xdt:Transform="RemoveAttributes(debug)" />

  <authentication xdt:Transform="Insert" mode="None" />

  <authorization xdt:Transform="Insert">
    <deny users="?" />
  </authorization>
</system.web>

I'm not certain which parts of the project can have an influence on this so I'm adding in the following. Please let me know if I have left out any other relevant parts.

The solution consists of two project. A Web project and a Class Library. The Class Library project has this in the app.config:

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>

which I think might be causing some of the problem (based on this article).

  • You can combine both of them in one httpRuntime element. `` – Chetan Mar 27 '17 at 10:51
  • Thanks, but since I'm not the one putting the tag in, I don't have control of that (as far as I understand). The tag is added when I deploy. – Jesper Baltzersen Mar 27 '17 at 11:09
  • First you need to check the the deployment logs. Web.config transformations are reported in the logs. Also if number of steps is large I would suggest to add manual intervention pauses between them and monitor when web.config is being changed. – Eduard May 04 '17 at 19:55
  • Thanks, I didn't know about the logs. It turned out that somewhere in the deploy process packages were not being updated such that I, what ended up on the server, was actually the same file as the one I was trying to swap out. – Jesper Baltzersen May 29 '17 at 20:39

0 Answers0