错误Service Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context解决办法

1. 装了GuidanceAutomationToolkitForVS2008.msi和WCSF, 从VSS获取别人建好的项目,由于别人的安装路径可能与自已的不同, 在

Add Business Module时,会出现找不到一些企业库的DLL, 此时,只成功的加了

ModuleInitializer/Controller/DefaultViewPresenter和各自的interface file, 但WebForm模块下没有成功加入文件, 编译也不通

过,解决此问题办法如下:
1). 最简单的办法,可以在solution的根目录下手动建文件夹Library,把用到的几个企业库DLL复制到下边,把刚没建好的Business

Module删除,重建一次就可解决.
2). 在没建好的Business Module基础上手动进行下去,在Buiness Module里添加所需的那几个企业库DLL引用,到WebSites那边加和

Business Module同名的文件夹,再右击些文件夹,执行Web Client Factory-->Add Page(with presenter)C#, 随便给页面一个名字

,假如叫UserList.aspx, 这样会自动的在刚才的Business Module下的Views文件夹加上UserListPresenter和IUserListView两个类

,当然这个页面代码里也会自动继承IUserListView。编译通过,但运行时会出现错误
错误message:
Service Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context. 
对比了一下能正常运行的项目,发现在WebSites下和Business Module同名的子文件夹下少了一个web.config文件,把它加上,内容

如下
<configuration>
  <configSections>
    <sectionGroup name="compositeWeb">
      <section name="modules" type="Microsoft.Practices.CompositeWeb.Configuration.ModulesConfigurationSection,

Microsoft.Practices.CompositeWeb"/>
      <section name="authorization"

type="Microsoft.Practices.CompositeWeb.Configuration.AuthorizationConfigurationSection,

Microsoft.Practices.CompositeWeb"/>
    </sectionGroup>
  </configSections>
  <compositeWeb>
    <modules>
      <module name="UserMaint" assemblyName="UserMaint" virtualPath="~/UserMaint">
        <dependencies>
          <dependency module="Shell" />
        </dependencies>
      </module>
    </modules>
    <authorization>
      <!-- Add your own view-rule mappings here:
          e.g.:
              <rule Url="~/HelloWorld/Default.aspx" Rule="AllowAccessHelloWorldDefaultView" />
          -->
    </authorization>
  </compositeWeb>
  <appSettings/>
  <connectionStrings/>
  <system.web />
</configuration>

修改当中的<module name="UserMaint" assemblyName="UserMaint" virtualPath="~/UserMaint">就可以了

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值