调用GetListItems(...)
Web服务方法时,我最终遇到异常。我正在使用Visual Studio Tools for Applications,因为我正在自定义InfoPath表单。这是创建.NET 2.0代码。
我坐在我的主机上,查询SharePoint WFE。在我从InfoPath 2010和InfoPath 2007切换之前,这已经很好地工作了。在我切换到InfoPath 2007之后,VSTA重新安装了一个可能导致som时髦的问题。有人知道如何解决这个问题吗?
我修改了.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)
答案 0 :(得分:0)
根据堆栈跟踪,您的应用程序在运行代码时没有WebPermission
。这可能是因为您的代码未在主机站点设置为完全信任(是的,这可能是由新安装引起的)。
检查主机代码的安全设置 - 您的代码现在无法创建WebRequests。