Wednesday, September 15, 2010

Infopath 2010 - Error while connecting to Web service

I was trying to populate data in Infopath form by calling webservice .

I was getting below error when I try to call webservice through code.

Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

After doing so many R&D, I found this can be solved by adding "Full" trust in Web.config, but in Infopath project, we won't get Web.config file. We have only App.Config file.

After searching in Infopath Form, where you can set Full Trust.

Open Infopath 2010 form in Design Mode.
Click on Langauge Tab.


Under Security and Trust - Select Full Trust option.

This will solve your problem