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
sporenzaAsked:
Who is Participating?
 
StanicDejanConnect With a Mentor Commented:
If you used my way, you need to issue separate commands for each .net runtime, e.g. (example):

for .net 1.1: C:\Windows\Microsoft.NET\Framework\v1.1.4322\caspol.exe ...
for .net 2.0: C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe ...

.net 3.0 and 3.5 use 2.0 runtimes, so there's no separate utility for them.

LP,
Dejan
0
 
PlatoConsultantCommented:
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...

0
 
PlatoConsultantCommented:
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Éric MoreauSenior .Net ConsultantCommented:
0
 
sanjeevnarayanCommented:
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

0
 
StanicDejanCommented:
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



0
 
sporenzaAuthor Commented:
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??
0
 
sporenzaAuthor Commented:
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....
0
 
sporenzaAuthor Commented:
Dejan,

Thanks I am looking into this know, sorry for the late
0
 
sporenzaAuthor Commented:
Dejan,

this worked thanks!!
0
All Courses

From novice to tech pro — start learning today.