2011-09-13 58 views
3

调用GetListItems(...) Web服务方法时,我结束了一个例外。我正在使用Visual Studio Tools for Applications来自定义InfoPath表单。这是创建.NET 2.0代码。从InfoPath表单(VSTA)调用SharePoint Web Service(_vti_bin/Lists.asmx)时发生System.Security.SecurityException

我坐在我的主机上,查询SharePoint WFE。在我从InfoPath 2010和InfoPath 2007切换之前,这一直很好地工作。在切换到InfoPath 2007之后,VSTA重新安装可能会导致som时髦问题。任何人都知道如何解决这个问题?

我修改了我的本地web.config for .net 2.0和我的.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) 

回答

0

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

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

相关问题