Friday, June 06, 2008

Running .NET applications from a Windows fileshare.

If you're trying to run a .NET application that's living on a remote fileshare, you need to do something like this to allow it to work:

caspol -m -ag 1.2 -url file:w:\* FullTrust

or

caspol -m -ag 1.2 -url file:\\server\path\blah\* FullTrust

caspol.exe is in the .NET SDK, installed to "C:\Windows\Microsoft .NET\Framework". I don't know if it is part of the standard .NET install. caspol.exe has to be copied locally to the machine too, it won't work from a remote share either.

Symptoms and times this'll cause you trouble:
- Remote debugging from one PC (XP or Vista) to another
- Error mesage: "[Program] failed to start, application configuration is incorrect."
- Error mesage: "Error while trying to run project: Unable to start debugging."
- Error mesage: "Access is denied"
- Error mesage: "
[Program] has encountered a problem and needs to close."
- Event log: Event ID 1000, Faulting Application.

If you use something like dependency walker on it, and find a missing reference to a DWMAPI.DLL, then that's a red herring. That DLL is conditionally loaded, and the condition isn't met on a machine that is missing it, so its not a problem.

Those caspol command lines are telling Windows to trust everything on that specified path, so beware!

No comments: