During a coding session recently, I needed to use the DotNetOptnAuth project to perform some authentication to a vary of outside services. I know that this library is available on the nuget package systems so I added the reference via nuget in Visual Studio. VS

Now, assuming you are the default Visual Studio Development Server and you run your project right away you’ll have a false sense of security that your project is all set and ready to go, like the following. All looks good right? Image 1

If you dig a little deeper, and set your project to use IIS express, like the following (If you don’t have IIS Express you can download it via the Web Platform Installer, or by downloading Web Matrix, which will get you IIS Express by default). Image 2

then try to debug your project you all of a sudden see an error about stating that you have a duplicate section defined in your web.config file. Image 3

So what’s the problem? It turns out that when we added the nuget package for DotNetOpenAuth, the package also adds a line to our project web.config like the following. Image 3

However, if you take a quick look at the machine.config for the .NET 4 framework located at the following location C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config you’ll see that there is a section alreay defined in the machine.config like the following. This is what is causing the conflict here. Image 3

So what’s the resolution? It’s pretty simple actually, you can either remove of comment out the <section> line in the project web.config and everything should be back to normal.

Side Note: There is a beta build of DotNetOpenAuth 4.0 that might address this issue, but I haven’t downloaded it yet to verify. If you have feel free to leave me a comment below.