Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Unable to access Environment variables
malcolmcooper
#1 Posted : Thursday, November 19, 2009 4:47:01 AM(UTC)
Groups: Member
Joined: 11/19/2009(UTC)
Posts: 4
Location: South Carolina

I have a VS 2008 Web application that accesses an environment variables using Environment.GetEnvironmentVariable. When I test in Visual studio it works fine. However, when I deploy and test through the Cassini web server, the environment variable is returning null. In VS I had to restart VS before it could see the new variable. I've restarted the UltiDev service, but that did not work. Should this work through the Cassini webserver? I am really hoping to not have to use IIS.

Thanks,
M
Ultidev Team
#2 Posted : Thursday, November 19, 2009 5:16:03 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Malcolm,

Which environment variable value are you trying to read? The most likely explanation of the behavior you are observing is that applications registered with UltiDev Cassini server are loaded into Cassini service process, which runs under Local System account. Visual Studio server runs under your account, which has somewhat different set of environment variables.

Please let us know if this information was helpful.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
malcolmcooper
#3 Posted : Thursday, November 19, 2009 5:31:04 AM(UTC)
Groups: Member
Joined: 11/19/2009(UTC)
Posts: 4
Location: South Carolina

I created a new system environment variable to store the path to a configuration file. I guess I assumed the local System account would have access to it. I checked and you were correct. The local system account is not able to see the environment variable, but if I update the service to login using my account it works. At least now I what the problem is.

Thanks,
Ultidev Team
#4 Posted : Thursday, November 19, 2009 2:02:04 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Malcolm,

When switching Cassini service to another account please keep in mind possible implications, like other applications using Cassini may be installed and need to have Local System. If you can, please see if you can find better storage for information you are passing through environment variables. Web apps running under Local System can access any common folder on the machine, so common application data folder could be a good place to put your data for the app to read.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.