et中的CannotLoadObjectTypeExceptio

et中的CannotLoadObjectTypeExceptio

本文介绍了Spring.net中的CannotLoadObjectTypeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs 2010中的asp.net 3.5项目中使用spring.net 1.3.1.我需要Spring来创建和操作对象.

I'm using spring.net 1.3.1 in a asp.net 3.5 project in vs 2010. I'm not doing any kind of mvc stuff; I needed Spring to create and manipulate objects.

我已按照文档进行操作,添加了Spring.Core和Spring.Web dll参考,我的web.config如下所示:

I've followed the documentation, added Spring.Core and Spring.Web dlls reference my web.config is like this:

   <sectionGroup name="spring">
    <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
    <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>

  </sectionGroup>
   <system.web>
     <httpModules>
        <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
     </httpModules>
     <!-- no spring confi in httpHandlers-->
  </system.web>
   <spring>
    <context>
      <resource uri="~/config/clients.xml" />
    </context>
  </spring>

在clients.xml中

in clients.xml

<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
  <object id="CAL"  type="myrouter.clientcode.CAL, myrouter.clientcode"/>
</objects>

在Defaults.aspx.cs中

in Defaults.aspx.cs

  IApplicationContext ctx = ContextRegistry.GetContext();
  CAL calobject = (CAL)ctx.GetObject("CAL");

我要

很抱歉,此篇长文章;我想尽可能地精确,并提供尽可能多的信息.我想我缺少了一些东西,但无法弄清楚是什么.在asp.net的spring.net配置中, HttpHandler 是必须的吗?

Sorry for this long post; I wanted to be as precised as possible and give as much as information that I could. I think I'm missing something but just can't figure out what. Is the HttpHandler a must in spring.net configuration in asp.net?

推荐答案

通常,此问题是您的某些错误导致的

Usually this issue is the result of some error in your

<object id="CAL"  type="myrouter.clientcode.CAL, myrouter.clientcode"/>

配置.

检查/验证以下内容:

  • 名称空间 myrouter.clientcode 确实是 CAL 类所在的地方
  • 包含这种类型的程序集实际上是 myrouter.clientcode
  • 这些名称空间和程序集名称在re:区分大小写方面也匹配

这篇关于Spring.net中的CannotLoadObjectTypeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 00:18