A Confused Programmer's Blog

This blog is dedicated to C# and Java programming that I happen to do for living – with accent on curious cases and with sincere intent to make the world of coding a slightly better place as a result

Connection to VIM API fails with ‘Insufficient permissions for setting the configuration’ error

I rarely post about the issues I am experiencing in this blog. This is mostly because most of the solutions are already there in the web. So, what pushed me to publish this post, is extremely rare scenario, that as I suspect might not be covered somewhere else.

In our testing automation framework we make extensive use of virtual machines. Most of control messages are passed using vSphere API (VIM API). To my dismay, I discovered that some of previously working code using this API ceased working properly, namely it start throwing exception during connection attempt:

System.Configuration.ConfigurationErrorsException: Insufficient permissions for setting the configuration section 'defaultProxy'. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
...
at Microsoft.Web.Services3.WebServicesClientProtocol.GetReaderForMessage(SoapClientMessage message, Int32 bufferSize)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Vim25Api.VimService.RetrieveServiceContent(ManagedObjectReference _this)
...

After digging up previous changes in related code configuration, I found that the problem was the following section added to the app.config of the project:

<system.net>
<defaultProxy>
<proxy autoDetect="False"/>
</defaultProxy>
</system.net>

Apparently, few months ago I added this configuration to prevent delays in WCF connection between framework modules. The connection between lack of proxy detection and the authentication is vague, but not totally non existent – as the reality shows. So, if you found this article while looking for help regarding that exception in the title, you might want to check your proxy settings.

Hope that helps.

Comments are closed.

Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

REST Assured and une

If you stumbled onto this article, it is safe to ...

Getting rid of Error

Since I upgraded my Windows 8 to Windows 10, I ...

Bypassing EULA step

We are working on automated testing of virtual appliance. This appliance ...

How I got rid of "Ac

OVF is a VMware virtual appliance format which allows you ...

My use-case of Perfo

In my blog I am set on a mission to ...

Twitter updates

RSS not configured