5

got a interesting problem. I placed a c# .net .exe file on a network share. If i try to

Start->Run: \\hostname\test.exe

my software starts properly and everything is working.

We also have a DNS Alias set for this computer, so if I try to run my program by:

Start->Run: \\mydnsalias\test.exe

My programm will cause an error message: "test has encountered a problem and needs to close..."

On client .net 2.0, 3.0, 3.5sp1 is installed. There is a full trust caspol for the network share (set with dnsalias).

Hans99
  • 51
  • 1
  • 2
  • Is the caspol hack applied to both hostname and mydnsalias? – Marc Gravell Jul 27 '10 at 07:31
  • What's the error? It should be in the more details part of the encountered a problem dialog. – NibblyPig Jul 27 '10 at 07:32
  • No, there is only "test has encountered a problem and needs to close..." as headline and below "If you have not saved your work yet, ... blahblah.." No additional message. Cause this in on a terminalserver, i cant give you information about eventlog. – Hans99 Jul 27 '10 at 07:33
  • 1
    Log the exception, and if it is the security exception, log all the properties of it, it should tell you what zone you need to specify the security settings for. – Lasse V. Karlsen Jul 27 '10 at 07:35
  • @Hans99 - re "only to dnsalias"; if you mean "mydnsalias", then it **shouldn't** work from \\hostname\test.exe. Are you sure there isn't a second caspol hack somewhere? Of course, the other option is that the caspol hack you've **added** for "mydnsalias" is simply wrong. – Marc Gravell Jul 27 '10 at 07:36
  • @Marc Gravell: This is my caspol machine entry: 1.6. Url - \\mydnsalias\\*: FullTrust (Exclusive) – Hans99 Jul 27 '10 at 07:39
  • @Lasse: Howto log this exception? It is thrown before my software really starts?! – Hans99 Jul 27 '10 at 07:39
  • You can try just outputting it to the console to begin with. And no, if there is an exception, your program has started. – Lasse V. Karlsen Jul 27 '10 at 08:10

1 Answers1

4

Caspol "tweaks" are a bit of a pain to deploy robustly. IMO, the best way to run an exe off the network is in a way that the core framework isn't going to object to in the first place.

Since you have 3.5 SP1, one simple way is to map the share to a drive. IIRC, with this service pack, "j:\test.exe" will be trusted, even though "j:" is mapped to "\hostname", and "\hostname\test.exe" might not be trusted.

The other approach is ClickOnce; you publish to the network share and run "test.application" instead. This also gives you options like local-copy with auto-update, file extension handling, etc.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • If i map the share (by dnsalias) i get the same error message. Its a problem with dnsalias only. If i use \\hostname everythign works fine, but as soon as i use \\mydnsalias it causes the error... SO i think this is no caspol failure. – Hans99 Jul 27 '10 at 07:37
  • ClickOnce is not an opinion for me in this case. – Hans99 Jul 27 '10 at 07:40