2011-09-13 63 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。

相關問題