2011-09-13 8 views
3

GetListItems(...) Webサービスメソッドを呼び出すときに例外が発生しました。私はInfoPathフォームをカスタマイズしているので、Visual Studio Tools for Applicationsを使用しています。これは.NET 2.0コードを作成しています。InfoPathフォーム(VSTA)からSharePoint Webサービス(_vti_bin/Lists.asmx)を呼び出すとSystem.Security.SecurityExceptionが発生する

私は自分のホストコンピュータに座って、SharePoint WFEに問い合わせています。 InfoPath 2010とInfoPath 2007に切り替える前にこれはうまくいきました。InfoPath 2007に切り替えた後、VSTAが再インストールされたことでおそらくファンキーな問題が発生しました。誰もがこれを解決する方法のアイデアを得た?

ローカルのweb.configの.net 2.0と.net framework 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を持っていません。これは、コードがホストサイトで完全な信頼として設定されていないために発生します(また、これは新しいインストールによって発生する可能性があります)。

ホストでコードのセキュリティ設定を確認してください。コードでWebRequestを作成できません。

関連する問題