开发者

Why am I getting a TypeLoadException when defining a custom profile?

开发者 https://www.devze.com 2022-12-24 19:10 出处:网络
I\'m writing a .NET command-line application that will migrate users from an existing database into aspnetdb. To simplify the user-specific settings, I\'m using the profile class that Joel Spolsky wro

I'm writing a .NET command-line application that will migrate users from an existing database into aspnetdb. To simplify the user-specific settings, I'm using the profile class that Joel Spolsky wrote about here.

It works great in the ASP.NET MVC website, but for some reason开发者_C百科 it's throwing a TypeLoadException when being used from this new application. I'm not sure why the framework is trying to load the new class from System.Web.


It turns out that you need to be more specific in the app.config file. Instead of writing this

<profile defaultProvider="SqlProvider" inherits="MigrationFromUDF.AccountProfile">

you need to specify the name of your application (or assembly)

<profile defaultProvider="SqlProvider" inherits="MigrationFromUDF.AccountProfile, MigrationFromUDF">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号