为什么Windows Server 2003上的温莎城堡的构造崩溃了清单? [英] Why does Castle Windsor constructor crash on Windows Server 2003 with a manifest?

查看:125
本文介绍了为什么Windows Server 2003上的温莎城堡的构造崩溃了清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

至于让我们的应用程序准备好Windows7中的一部分,我们最近增加了一个清单给我们我们的用户界面的exe文件。

As part of getting our application ready for Windows7, we recently added a manifest to our our user interface's exe.

它运行确定在Windows7。但是,现在当我尝试在Windows Server 2003上运行的exe文件签署,该程序在启动时崩溃。我已经看过了崩溃转储,并由于没有在Castle.Core.Resource.ConfigResource的构造是由Program.Main方法中调用似乎。

It runs ok on Windows7. However, now when I try to run the signed exe on Windows Server 2003, the program crashes during startup. I've looked at the crash dump, and it seems to by failing in the constructor of Castle.Core.Resource.ConfigResource which is called from the Program.Main method.

如果这是包含在清单中:

If this is included in the manifest:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    </application>
</compatibility>

再崩溃,但如果我注释掉并重建,它的确定。

then it crashes, but if I comment it out and rebuild, it's ok.

你有什么可能会造成这个问题的任何想法?

Have you got any ideas about what could be causing the problem?

推荐答案

嗯,我仍然不知道为什么它不工作的原因,但我有一个解决办法。

Well, I still don't know the reason why it doesn't work, but I have a workaround.

IWindsorContainer container =
    new WindsorContainer(
        new XmlInterpreter(new ConfigResource("castle")));

将配置成一个字符串,并加载它是这样的:

Move the config into a literal string and load it this way:

StaticContentResource scr = new StaticContentResource(
    @"<configuration>
        <!-- Move stuff that was originally in the app.config to here -->
    </configuration>"
    );
IWindsorContainer container = new WindsorContainer(new XmlInterpreter(scr));

看来问题是向下运行此行ConfigResource的构造:

It seems the problem is down to ConfigResource's constructor running this line:

XmlNode section = (XmlNode) ConfigurationManager.GetSection(sectionName);

如果我用mt.exe添加一个清单到控制台返回null,但返回的预期值,如果我不知道。

this returns null if I use mt.exe to add a manifest to the console, but returns the expected value if I don't.

这篇关于为什么Windows Server 2003上的温莎城堡的构造崩溃了清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆