Link to home
Start Free TrialLog in
Avatar of sporenza
sporenza

asked on

Run Simple VB.Net EXE over network

OK, I am attaching a simple program I created in VB.NET, I can run this code from my desktop (XP Pro SP2) no problem, but if i place it on another machine in our network (XP Pro SP2) and run it from the command line (the networked machine is sharing a drive) from that machine I get a big error (see attached).  I can run the exe on the other machine and it works fine...

Thanks for the help!!
Imports System.IO
Imports System.Console
 
Module Module1
 
    Sub Main()
 
        WriteLine("1")
        Dim oExcel As Object = CreateObject("Excel.Application")
        WriteLine("1")
        Dim oBook As Object = oExcel.Workbooks.Add
        WriteLine("1")
        Dim oSheet As Object = oBook.Worksheets(1)
        WriteLine("1")
        oSheet.Range("A1").Value = "mydata"
        WriteLine("1")
        oBook.SaveAs("C:\result.xls")
        WriteLine("1")
 
        Exit Sub
 
    End Sub
 
 
End Module

Open in new window

ErrorReport.txt
Avatar of PlatoConsultant
PlatoConsultant
Flag of United States of America image

if u copy the exe to the Local machine and then run it from there u will not find this error

.net security system has to be configured and Network access permissions have to be given according to the active directory and ur network topology...


 simple solution is that copy the exe to  the local machine may be deploy it using click once and start using it...

hmmm.... It is a simple permission issue if you are trying to run this over Network share...

You can change the .NET "Code Access Security Policy" to Full trusted on the other machine and it will work fine...

how to do that :
Control Panel>Administrative Tools>Microsoft .Net Framework x.x Configuration
Expand "my computer" and "Runtime Security Policy" in the right hand side choose "Adjust Zone Security" under tasks. In the security config box check "Make Changes to this Computer" and next, then select "Local Intranet" and change the security level to Full Trust.

hope it helps
Sanjeev
for more information http://www.touchstar.com.au/2008/default.aspx

Avatar of StanicDejan
StanicDejan

There is a CASPOL command line utility included with .net runtime.

You'll find it in %WINDOWS%\Microsoft.NET\Framework\v2.0.507272\CasPol.exe (of course, substitute 2.0... for your version of .net). With this utility, you can easily adjust security.

For example, to allow full trust for .net applications running from youl LAN, you can issue the following command:

caspol -machine -chggroup LocalIntranet_Zone FullTrust

and your problem should go away.

LP,
Dejan



Avatar of sporenza

ASKER

All,

I got it to work thanks!!!

Is there anyway I can catch this error with VB so that I can send a clearer email to the customer running the app??
update,

ok so this worked on my first machine that had studio installed, but on another machine that had .Net 1.1 isntalled I had to upgrade to 2.0 (needed to to run the code) and then changed the internat settings to full trust but I still get the same error on this machine....
ASKER CERTIFIED SOLUTION
Avatar of StanicDejan
StanicDejan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dejan,

Thanks I am looking into this know, sorry for the late
Dejan,

this worked thanks!!