开发者

System.Security.SecurityException when calling SharePoint Web Service (_vti_bin/Lists.asmx) from InfoPath form (VSTA)

I have ended up with an exception when calling the GetListItems(...) web service method. I am using Visual Studio Tools for Applications as I am customizing an InfoPath form. This is creating .NET 2.0 code.

I am sitting on my host computer, and querying the SharePoint WFE. This has been working nicely before I switched from InfoPath 2010 and InfoPath 2007. After I switched over to InfoPath 2007, VSTA was reinstalled an probably caused som funky issues. Anyone got an idea on how to solve this?

I have modified both my local web.config for .net 2.0, and my .net framework configuration 2.0 to allow full trust on the strong name of my application.

Any tips?

The full stacktrace:

System.Security.SecurityException was unhandled by user code
  Message="Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
  Source="mscorlib"
  StackTrace:
       at Sys开发者_Python百科tem.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessPermission.Demand()
       at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
       at System.Net.HttpRequestCreator.Create(Uri Uri)
       at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
       at System.Net.WebRequest.Create(Uri requestUri)
       at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
       at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at Sjekkliste2.SharePointLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)
       at Sjekkliste2.FormCode.EnhetExists(String lokasjon)
       at Sjekkliste2.FormCode.ddLokasjon_Validating(Object sender, XmlValidatingEventArgs e)
       at Microsoft.Office.InfoPath.Internal.XmlEventHost.GenericProxy(Object genericDelegate, DataDOMEvent dataDOMEvent, InfoPathEvents type)
       at Microsoft.Office.InfoPath.Internal.XmlEventHost.ValidatingProxy(DataDOMEvent dataDOMEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnValidate(DataDOMEvent pDataDOMEvent)


According to the stack trace, your application doesn't have WebPermission while running the code. This can be caused because your code isn't set as full trust at your host site (and yes, this could be caused by new install).

Check the security settings for your code at the host - your code can't create WebRequests now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜