在调用GetListItems(...) web服务方法时,我遇到了异常。在自定义InfoPath表单时,我正在使用Visual Studio Tools for Applications。这是在创建.NET 2.0代码。
我正坐在我的主机上查询SharePoint WFE。在我从InfoPath 2010和InfoPath 2007切换之前,这一直运行得很好。在我切换到VSTA2007之后,InfoPath被重新安装了,这可能导致了一些时髦的问题。有谁有办法解决这个问题吗?
我已经针对.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)发布于 2011-09-14 13:49:20
根据堆栈跟踪,您的应用程序在运行代码时没有WebPermission。这可能是因为您的代码在宿主站点上没有设置为完全信任(是的,这可能是由新安装引起的)。
在主机上检查你的代码的安全设置-你的代码现在无法创建WebRequests。
https://stackoverflow.com/questions/7400326
复制相似问题