开发者

.NET 2.0 app on Windows Server 2003 doesn’t load a .config file

开发者 https://www.devze.com 2022-12-12 03:08 出处:网络
I can’t made my .NET 2.0 applicati开发者_StackOverflow中文版ons (and services) to load their appname.exe.config files on Windows Server 2003 Standard Edition SP2,

I can’t made my .NET 2.0 applicati开发者_StackOverflow中文版ons (and services) to load their appname.exe.config files on Windows Server 2003 Standard Edition SP2,

I tried to create manifest like this but it didn’t worked

EDIT:

  • Appname.config is located in the same dir,
  • App works without any changes on Windows XP, once we move files or use setup to install it on 2003 it fails to load .config file.
  • The "working directory" of the executable IS the same as it's path! We didn’t change anything while moving it from XP to 2003

I’ve tried process monitor, it says for operations CreateFile and QueryOpen: name not fount, like this file would not exists, but I assure, it is!

I think it might be something wit manifest files under 200, according to this thred on MS Connect

but I don’t know how to solve the problem.


This might be the solution:

http://blogs.msdn.com/junfeng/archive/2006/08/09/692996.aspx

To workaround the bug, add an assemblyIdentity to the SxS manifest.

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    version="1.0.0.0"
    name="Foo"
    type="win32"
  />

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>


Two things come to mind: First, is the config file located in the same directory as the executable?

Second, is the "working directory" of the executable the same as it's path? If the working directory isn't correct, then it won't be able to locate the file.

One more thing to do would be to get a copy of sysinternals, specifically the process explorer tool to see what file (and path) it's trying to load.


What do you mean by cannot load? Any exception message .Net throws at you? Or it just dies silently?

Your app should load yourexe.exe.config, i.e., mainform.exe.config, where mainform.exe is your app name.

0

精彩评论

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