2010-09-09 23 views
1

我在由WCF RIA Services安裝程序安裝的System.ServiceModel.DomainServices.Server程序集中的AuthenticationBase類上調用UpdateUser。這適用於我的Win 7桌面,但在我的Win 7筆記本電腦上,出現以下異常。AuthenticationBase上的MethodAccessException <User> .UpdateUser異常

任何想法,我應該尋找什麼,或者我怎樣才能確定兩個系統之間的不同?謝謝。

System.MethodAccessException was unhandled 
     Message=Attempt by method 'System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1<T>.IsReadOnly(System.Reflection.PropertyInfo)' to access method 'System.Linq.Enumerable.Cast<System.ComponentModel.DataAnnotations.EditableAttribute>(System.Collections.IEnumerable)' failed. 
     Source=System.ServiceModel.DomainServices.Server 
     StackTrace: 
      at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.IsReadOnly(PropertyInfo propertyInfo) 
      at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateProfile(T user) 
      at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateUserCore(T user) 
      at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateUser(T user) 

回答

0

這聽起來像你沒有筆記本電腦實例的反射許可。

你可能在其他用戶帳戶下運行它?

看看MethodAccessException docs

此外,要確保正在運行的.NET的版本相同,因爲在.NET 4

+0

是引入了安全更改。兩個本地帳戶。如何確定用戶是否具有反射許可? – 2010-09-09 07:15:59

+0

你將不得不使用'ReflectionPermission.Demand()'。用更多信息更新答案。 – leppie 2010-09-09 07:31:10

+0

我不知道該怎麼做。我一直在尋找線索,但一無所獲。權限是在被調用的程序集上還是在調用代碼的客戶程序集上進行的? – 2010-09-09 08:03:08