解决 - 未解析成员“Assembly.Class,Assembly, Version=*.*.*.*, Culture=neutral, PublicKeyToken=null”的类型。...

A few days ago, I spend almost a day figuring out what went wrong with an application I was writing. Apparently a SerializationExeption can occur when executing ASP.NET code in the ASP.NET Development Server (Cassini).

Exception:
Type is not resolved for member ‘Classname,Assembly, Version=1.1.0.31, Culture=neutral, PublicKeyToken=null’.

Exception details:
System.Runtime.Serialization.SerializationException: Type is not resolved for member …

When executing the same website in IIS, everything runs fine.

 

For some strange reason the ASP.NET Development server loads the different assemblies in different ApplicationDomains, resulting in members that cannot be found.

There are different solutions to be found on the web, like inheriting your objects from MarshalByRefObject, but this can have a performance drop.

There is a simpler way in my opinion:
First of all specify the directory containing the assembly in the DEVPATH environment variable.
(Do this by opening the System Properties, properties of My Computer. At the bottom of the Advances tab page, you have a Environment Variables button. Just add the variable to your user only.)
System Properties Environment Variables

Secondly, open the machine.config Normally you’d expect that web.config would do too, but that isn’t the case, it has to be machine.config! (This way, there isn’t any trace of this fix in theproject itself)
Add the following code:

<configuration>
   <runtime>
       <developmentMode developerInstallation=”true”/>
   </runtime>
</configuration>

Save it, restart the ASP.NET Development server(s) and you’re good to go.

Report of the issue.

Note: there is 1 downside, sometimes, the .dll files that Visual Studio generates can get locked by Cassini. Restarting it helps.

转载于:https://www.cnblogs.com/borllor/archive/2008/02/16/1070308.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值