SecurityException in ASP.net Application
I have a web application that asks for Lucene index and works fine on a W2K3 server on my network. Now I got my azure code, so I wanted to check the application loading. To do this, I had to install Vista (I did it in a virtual machine) because the Azure SDK won't install in the XP box.
I created my cloud service, added files from my app, but when I start it (just F5), I get a SecurityException when I call Lucene to query the index, saying:
The application tried to perform an operation not permitted by security policy. To grant this application permission is required, contact your system administrator or change the trust level of applications in the configuration file.
I did googling, and the solutions I found are about modifying the machine.config file, which I can't do "in the cloud".
Can anyone help with this?
source to share
Ok if anyone is facing the same problems, this is the correct answer I got on the Azure forum:
This is due to the Windows Azure CTP trust policy. the variable temperatures TEMP and TMP are available and set accordingly. However, System.IO.Path.GetTempPath and System.IO.GetTempFile do not work because they require unrestricted environment permission. I would suggest that you contact the Lucene developers to see if they can change the code to work correctly in the trust environment.
Thanks to Daniel K. Wang for the answer.
source to share
I also found a question regarding my own problem and how it was fixed.
Here's the link: Lucene.Net is failing on my host because it calls GetTempPath (). What job?
source to share
You can change the trust of the web.config, unless it has been allowed in the machine.config file (which is often used in shared hosting). inside your post and see what happens.
If you are not allowed to do this, see if you can access the GACd by talking to your ISP. If that doesn't work, sorry, but out of luck. Sometimes you can find workarounds that do not require full trust for a particular method, but if a third party DLL requires it, you cannot do
source to share