locked
Run form over network RRS feed

  • Question

  • After building the windows form I put the .exe file on the server and want users that have access to the server through My Network to be able to run the file and use the windows form. But when I try to run an the application it gives me an error. It works fine when it is on the local computer been does not work when you try to access it over the network. I am guessing that it is because of some security issues but I don't know how to resolve this issue.The error is:test.exe has encountered a problem and needs to close. We are sorry for the inconvenience.and then it has the "tell Microsoft" text and buttons.TIA
    Tuesday, December 5, 2006 6:12 PM

Answers

  • You will need caspol.exe included in 2.0SDK to add the permission sets. You can't use 1.1Configuration Tool to setup permission set for 2.0.

    try this

    caspol.exe -pp off -machine -ag LocalIntranet_Zone -url file://servername/foldername/* FullTrust -name MYAPPCENTRAL

    MYAPPCENTRAL - can be anything
    file://servername/foldername/* - UNC path or file://W:/*
    * - all items in the folder or mapped drive

    NOTE: make sure to re-sign the assemblies (dll and exe) using sn -R <assembly> <sign-key>.

    Thursday, December 7, 2006 9:16 PM

All replies

  • You should try to post up more information that that... also have you tried debugging it? I know there is something that you can use to debugg the .exe  
    Tuesday, December 5, 2006 6:32 PM
  • Make sure you have the build configuration set to "Release" and not "Debug".
    Tuesday, December 5, 2006 9:11 PM
  • Hi,

    Please go through the following link. This should help you resolve your problem.
    http://msdn.microsoft.com/msdnmag/issues/04/05/ClickOnce/

    thank you,
    bhanu.

    Tuesday, December 5, 2006 11:26 PM
  • Thanks for all your feedback and help. Let me try to be more clear. I am not using Visual Studio, just notepad++ to do all this. I create a file (test.cs) then build it using a batch file with command: (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc /t:winexe /out:test.exe /r:System.dll,System.Windows.Forms.dll,System.Drawing.dll,System.Data.dll,System.Xml.dll test.cs) After test.exe file is created without error I put it up on a server location (\\server\files\test.exe). Then I want to be able to run the form from that server location so that I would not have to download it on every computer I want to use it on. But I get that error I mentioned. Is this possible to accomplish or does the windows form app have to be on the local or any  computer I want to run it on? Again thanks for your help and time.
    Wednesday, December 6, 2006 2:55 PM

  • Check this blog post, it describes what most likely is the issue you are dealing with.

    I didn't check, but the same technique should apply for v2.0 of the framework.

    Wednesday, December 6, 2006 4:36 PM
  • you need to either decrease the trust of the .NET assembly on your local machine/computer that is going to be running the application or as suggested in the long, strong name/sign the assembly so its trusted to run over the network
    Wednesday, December 6, 2006 7:56 PM
  • Thanks for the link. It seems like this should fix the problem but it still will not work.I go to the .NET Configuration 1.1 > My Computer > Runtime Security Policy > Machine > Code Groups > All_Code > LocalIntranet_Zone and I change the Permission Set to FullTrust. When I try to run the application I still get the same error. System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, etc' failed. The action that failed was: Demand. The type of the permission that failed was: System.Security.Permissions.FileIOPermission. The Zone of the assembly that failed was: Intranet. Thanks for all your help.
    Thursday, December 7, 2006 3:51 PM

  • Is it a typo or you have indeed tried to set up your 1.1 environment?

    You seem to be running a 2.0 application..?
    Thursday, December 7, 2006 7:24 PM
  • You will need caspol.exe included in 2.0SDK to add the permission sets. You can't use 1.1Configuration Tool to setup permission set for 2.0.

    try this

    caspol.exe -pp off -machine -ag LocalIntranet_Zone -url file://servername/foldername/* FullTrust -name MYAPPCENTRAL

    MYAPPCENTRAL - can be anything
    file://servername/foldername/* - UNC path or file://W:/*
    * - all items in the folder or mapped drive

    NOTE: make sure to re-sign the assemblies (dll and exe) using sn -R <assembly> <sign-key>.

    Thursday, December 7, 2006 9:16 PM