1

I'm pretty new to ASP.NET and Visual Studio, but when I installed the Microsoft.AspNet.WebPages.OAuth package with the Nuget Package Manager the project now get a Runtime Error. I was following this answer from an earlier stackoverflow question: How to add ASP.NET Membership Provider in a Empty MVC 4 Project Template?

Anyone know why this happens?

I would like to give you some code, but not quite sure what code to provide for you. The following lines is at least been added to the config file after installing the package, might those broke down the project?

<configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />  
       <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
          <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
          <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
          <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" />
          <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" />
      </sectionGroup>
</configSections>

In advance, thanks for the help.

Updated:

Error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Community
  • 1
  • 1
Ørjan
  • 2,749
  • 2
  • 16
  • 24

1 Answers1

0

There a at least two separate problems here. The first is the inclusion of the automatically generated

   <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
      <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
      <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
      <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" />
      <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" />
  </sectionGroup> 

Apparently in the earlier versions of MVC this code was necessary. However, it is currently redundant and worse, in conflict with the an identical block contained in "machine.config" found in the 4.5 .NET framework, By carefully removing these blocks, in an editor outside VS2013 at least what I'm using, the this problem will be resolved. I say an external editor because some catch 22 in VS 2103 prevents the editing , AND SAVING, of this block from the config.web sections in the Solution. I use Notepad++ The second problem may have to do with locating the references to System.Web.WebPages.Razor in your entire solution, If the version number in the not 3.0.0.0, i.e. 2.0.0.0 then update it and make sure nuget has loaded 3.0.0.0 The entire dotNetOpenAuth package has self induced problems with earlier versions of MVC solutions. I am trying to use examples from the book ASP.NET Web API Security. It contains brilliant code but huge problems are encountered when attempting to run the Solutions that include dotNetOpenAuth code. The problems all have to do with MVC levels and dotNetOpenAuth, not the examples themselves.

user3594395
  • 181
  • 4
  • 7