|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application.StartupPathI 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 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 Show quoteHide quote "Rick" <R***@LakeValleySeed.com> wrote in message news:eVh0Qcs%23GHA.4544@TK2MSFTNGP05.phx.gbl... >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 > 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 wrote: Show quoteHide quote > 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" <R***@LakeValleySeed.com> wrote in message > news:eVh0Qcs%23GHA.4544@TK2MSFTNGP05.phx.gbl... > >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 > > 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 Show quoteHide quote "rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message news:1162093457.340603.113830@m7g2000cwm.googlegroups.com... > 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 wrote: >> 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" <R***@LakeValleySeed.com> wrote in message >> news:eVh0Qcs%23GHA.4544@TK2MSFTNGP05.phx.gbl... >> >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 >> > > You can strong name an exe. Just go to your project properties - it's
on one of the tabs there. Thanks, Seth Rowe Rick wrote: Show quoteHide quote > 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_em***@yahoo.com> wrote in message > news:1162093457.340603.113830@m7g2000cwm.googlegroups.com... > > 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 wrote: > >> 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" <R***@LakeValleySeed.com> wrote in message > >> news:eVh0Qcs%23GHA.4544@TK2MSFTNGP05.phx.gbl... > >> >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 > >> > > >
Constants can't be defined in a namespace. WTH?
Selecting a single node in 'XML' Math class for Visual Basic.NET (matrix operations) Graph control webreq.getresponse exceptions Adding a Web Reference into a Windows Project turn off assertions in VB 2005 Errors in Page directive Determine if xml is malformed user rights for running VB |
|||||||||||||||||||||||