2

I have a maddening situation here with an MVC4 site. At the outset, you need to know it uses Windows authentication, and I also want to use simplemembership roles (but I don't think this is working--but this is not the focus of my question). Basically, the site works on my dev machine (with IIS Express) and a test machine (with regular IIS). But it doesn't work in production environment. We get an error "could not load file or assembly WebMatrix.WebData, version=2.0.0.0.

The WebMatrix.WebData reference has CopyLocal = False. (This works in dev and test.) If I set CopyLocal = True, then the authentication goes haywire. Specifically, when you visit the site, it attempts a redirect to login.aspx (obviously not an MVC component). So, my question is Why is this happening? How do I fix?

Here's what I've got under my system.web element in the config:

<roleManager enabled="true">
  <providers>
    <clear/>
    <add name="simple" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData"/>
  </providers>
</roleManager>
<membership>
  <providers>
    <clear/>
  </providers>
</membership>
<authentication mode="Windows" />

I've played around with this quite a bit trying to understand the problem, but I don't really know what I'm doing with this config section/what all can be done. I wonder if there's a problem clearing all the membership providers.... while trying to use the SimpleRoleProvider. (I tried cutting out SimpleRoleProvider, but this had no effect on problem.)

Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
Adam O'Neil
  • 667
  • 1
  • 8
  • 18
  • btw, the reason I have a WebMatrix reference at all is so I can get the current user name without being inside a controller. (WebSecurity.CurrentUserName works outside of a controller.) – Adam O'Neil Jun 20 '13 at 14:39
  • Possible duplicate: http://stackoverflow.com/questions/12049926/asp-net-4-5-custom-membership-provider-configuration-throws-strange-exception – Beans Nov 15 '13 at 18:35

0 Answers0