Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causing WebMatrix.Data.dll and WebMatrix.WebData.dll to be added to my bin directory

Tags:

c#

asp.net

dll

I have an MVC ASP.Net app that I have been working on. It works fine only about half the time when I try to load a page I get diverted to a login.aspx?ReturnUrl=ENCODED_REQUESTED_PATH_HERE. This is very frustrating after some searching on the internet I found that this was caused by

WebMatrix.Data.dll
WebMatrix.WebData.dll

When I delete these the problem does go away and after commenting out these two lines in my IISExpress applicationhost.config

<!--<add name="WebMatrixSupportModule" image="%IIS_BIN%\webmatrixsup.dll" />-->
<!--<add name="WebMatrixSupportModule" lockItem="true" />-->

The files stayed away for a while but now they are back and causing the problem again.

What is putting them in there, there is no reference to them in the project.

like image 320
James Robinson Avatar asked Sep 23 '13 17:09

James Robinson


2 Answers

They are added by NuGet packages that come with ASP.NET MVC 4 project templates.

You can get more information at What is the Microsoft ASP.NET Web Pages 2 Data Nuget Package for?

These assemblies provide Simple Membership Provider that is conflicting with your authentication. Are you using forms auth & have you correctly Implemented Authorize attribute? If your controllers are marked with Authorize attributes correctly then you will not have any problem. Presence of these dll is not the problem. Your controllers are not property authorized.

like image 50
Akash Kava Avatar answered Oct 05 '22 23:10

Akash Kava


For anyone who suddenly started getting WebMatrix dlls (WebMatrix.Data.dll / WebMatrix.WebData.dll) in their bin: My solution to remove them was the following:

  1. Install the nuget packages:
    • Microsoft.AspNet.WebPages.Data
    • Microsoft.AspNet.WebPages.WebData
  2. Then uninstall them.

This resulted in the following [dependentAssembly] being added to the Web.config [configuration] -> [runtime] -> [assemblyBinding]

  <dependentAssembly>
    <assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>

For some reason, despite the tag "dependent assembly", it does the opposite and prevents the WebMatrix dlls from showing up.

The reason why I personally needed to get rid of the WebMatrix dlls was because, when deployed to a server, it would ask for Razor ver.2, when I had Razor ver.3 included and in active use, throwing an exception and breaking the entire website. Just, simply, deleting the WebMatrix dlls from the server's bin folder would relieve the website of this problem.

like image 30
ZethrosIG Avatar answered Oct 05 '22 23:10

ZethrosIG