Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Application.StartupPath

16 views
Skip to first unread message

Rick

unread,
Oct 28, 2006, 3:27:02 PM10/28/06
to
I have a VB.Net 2005 application that I am publishing to a network file
server.

The app reads an xml file that has some database connection information in
it. This xml file is located in the same folder as the executable.

The problem is when I double click on the appname.application on the server
the program can't find the xml file because the Application.StartupPath is:

C:\Documents and Settings\UserName\Local Settings\Apps\2.0\...

So it looks like the program is being run from the local client rather than
the file server.

Why is that happening and is there some way to find out inside the program
where the .exe really is located?

Rick


Rick

unread,
Oct 28, 2006, 4:44:00 PM10/28/06
to
Well, I figured out part of the problem.

I'm new to VB.net and did not understand that I was Publishing the
application and clicking on the .application was installing it on the local
computer.

However when I just copy the exe file to the file server (along with the xml
file for db configuration) I get an unhandled exception. What should I be
doing to get the exe to run on the server from a common location so all
clients can access it

"Rick" <Ri...@LakeValleySeed.com> wrote in message
news:eVh0Qcs%23GHA...@TK2MSFTNGP05.phx.gbl...

rowe_newsgroups

unread,
Oct 28, 2006, 11:44:17 PM10/28/06
to
I'm guessing you're getting a security access violation? This is due to
the fact that the .Net code security policy by default doesn't like
programs deployed on network drives (the permission set for local
intranet is almost nothing). Anyways, if I'm right then follow the
bellow steps to change your app's security policy settings.

Goto control panel --> admin tools --> Microsoft .Net Framework 2.0
Configuration. Expand the Runtime Security Policy Node. Expand the
Machine Level node.
Expand the Code Groups node. Right click on the All_Code node and
select "New..." Follow the wizard to build the new permission set (I
normally use strong name - see the .Net help for how to add a strong
name to you're solution). After you finish the wizard, you should be go
to go (on your computer at least!) So before you exit the Framework
Configuration, right click on "Runtime Security Policy" and select
"Create Deployment Package" and follow the wizard (be sure to select
Machine Level). This msi installer has to be run on each computer that
is going to use your program, and it must be run of the local drive -
running it from the network drive will not do anything. I had our
company's Network admin set up a login script to run the installer - I
think it the easiest way to accomplish it.

Let me know if that helps,

Seth Rowe

Rick

unread,
Oct 29, 2006, 8:47:45 AM10/29/06
to
thanks Seth,

I'm plodding through this very unfamiliar territory!

First I had to do a repair on .NET 2.0 since there was no mscorcfg.msc ever
created for v 2.0. Odd since it should have been installed when I installed
VS 2005.

Anyway now I've got that up and running and can proceed.

Firstly, from what I see about Strong names, it seems they are just for dll
signing. I have an executable. Is this correct, or is it possible to
create a strong name for exe's as well?

Rick

"rowe_newsgroups" <rowe_...@yahoo.com> wrote in message
news:1162093457.3...@m7g2000cwm.googlegroups.com...

rowe_newsgroups

unread,
Oct 29, 2006, 8:28:34 PM10/29/06
to
You can strong name an exe. Just go to your project properties - it's
on one of the tabs there.

Thanks,

Seth Rowe

0 new messages