English 中文(简体)
.NET 2.0 app on Windows Server 2003 doesn’t load a .config file
原标题:

I can’t made my .NET 2.0 applications (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.





相关问题
Autopaging or custom paging which is better in datagrid?

i used datagrid control in .net platform... but now i am in big confusion .. that is ..which is better to used custom or autopaging option.. gud explaination or example is needed.. i dont know ...

Gridview item preview using .net 2.0

I have a GridView control that for each item has a Hyperlinkfield with a URL to an aspx page. I want to (using AJAX libraries) to display the page preview in an inline window as the user hovers over ...

Rendering form to bitmap

I would like to render Form to bitmap... Is it possible in .net 2.0?

Transactions in .Net 2.0 application-- what to use?

I m working on a .Net 2.0 application and need to wrap some database transactions in my code. The backend is SQL Server 2008. I ve been away from .net for a few years, the last time I did any ...

Subsonic query: issue with the produced query

I m having a problem with subsonic query. The deal is, I have a view and I want to query it s data to produce something like the following SQL statement: select * from myView where (col1 like %a% ...

热门标签