【问题标题】:System.Security.SecurityException when calling SharePoint Web Service (_vti_bin/Lists.asmx) from InfoPath form (VSTA)从 InfoPath 表单 (VSTA) 调用 SharePoint Web Service (_vti_bin/Lists.asmx) 时出现 System.Security.SecurityException
【发布时间】:2011-09-14 13:49:20
【问题描述】:

我在调用GetListItems(...) Web 服务方法时遇到了异常。我在自定义 InfoPath 表单时使用 Visual Studio Tools for Applications。这是在创建 .NET 2.0 代码。

我坐在我的主机上,查询 SharePoint WFE。在我从 InfoPath 2010 和 InfoPath 2007 切换之前,这一直运行良好。在我切换到 InfoPath 2007 之后,重新安装了 VSTA,这可能导致了一些时髦的问题。有人知道如何解决这个问题吗?

我已经修改了 .net 2.0 的本地 web.config 和 .net 框架配置 2.0,以允许完全信任我的应用程序的强名称。

有什么建议吗?

完整的堆栈跟踪:

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 System.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)

【问题讨论】:

    标签: web-services sharepoint-2007 infopath-2007


    【解决方案1】:

    根据堆栈跟踪,您的应用程序在运行代码时没有WebPermission。这可能是因为您的代码在您的主机站点上未设置为完全信任(是的,这可能是由新安装引起的)。

    在主机上检查您的代码的安全设置 - 您的代码现在无法创建 WebRequest。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 2018-08-24
      • 1970-01-01
      相关资源
      最近更新 更多