2014-10-27 96 views
7

剛剛更新了Azure移動服務的許多軟件包,現在我收到「未找到方法」錯誤。這在其他地方還沒有報道過。任何想法哪個包需要降級?還是另一個解決方法?未找到JwtSecurityTokenHandler.set_CertificateValidator方法

[MissingMethodException: Method not found: 'Void System.IdentityModel.Tokens.JwtSecurityTokenHandler.set_CertificateValidator(System.IdentityModel.Selectors.X509CertificateValidator)'.] 
     Microsoft.WindowsAzure.Mobile.Service.Security.Providers.GoogleLoginProvider..ctor(HttpConfiguration config, IServiceTokenHandler tokenHandler) +0 
     lambda_method(Closure , Object[]) +174 
     Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +419 

    [DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(System.Web.Http.HttpConfiguration, Microsoft.WindowsAzure.Mobile.Service.Security.IServiceTokenHandler)' on type 'GoogleLoginProvider'. ---> Method not found: 'Void System.IdentityModel.Tokens.JwtSecurityTokenHandler.set_CertificateValidator(System.IdentityModel.Selectors.X509CertificateValidator)'. (See inner exception for details.)] 
     Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +999 
     Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +589 
     Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +109 
     Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +63 
     Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +201 
     Autofac.Core.Resolving.InstanceLookup.Execute() +262 
     Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +282 
     Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72 
     Autofac.Features.Collections.<>c__DisplayClass6.<RegistrationsFor>b__1(IComponentRegistration cr) +60 
     System.Linq.WhereSelectArrayIterator`2.MoveNext() +66 
     System.Linq.Buffer`1..ctor(IEnumerable`1 source) +335 
     System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77 
     Autofac.Features.Collections.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p) +256 
     Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +191 
     Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +109 
     Autofac.Core.Resolving.InstanceLookup.Execute() +158 
     Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +282 
     Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +60 
     Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +111 
     Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +279 
     Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +57 
     Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +175 
     Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +250 
     Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters) +72 
     Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType) +63 
     Microsoft.WindowsAzure.Mobile.Service.Config.AutofacDependencyScope.GetServices(Type serviceType) +269 
     System.Web.Http.DependencyScopeExtensions.GetServices(IDependencyScope services) +172 
     System.Web.Http.DependencyScopeExtensions.GetLoginProviders(IDependencyScope services) +41 
     Microsoft.WindowsAzure.Mobile.Service.Config.OwinAppBuilder.ConfigureAuthentication(IAppBuilder appBuilder, HttpConfiguration config) +379 
     Microsoft.WindowsAzure.Mobile.Service.Config.OwinAppBuilder.Configuration(IAppBuilder appBuilder) +70 
     Microsoft.WindowsAzure.Mobile.Service.<>c__DisplayClass5.<ConfigureOwin>b__4(IAppBuilder appBuilder) +40 
     Microsoft.WindowsAzure.Mobile.Service.Config.StartupOwinAppBuilder.Configuration(IAppBuilder appBuilder) +234 
+0

一般來說,更新後端項目中的軟件包並不是一個好主意,因爲我們的主機環境中有特定版本,當您更新時可能不兼容。 – 2014-12-05 20:07:17

回答

10

我剛有同樣的問題,並已獲得了移動業務VS

卸載包WindowsAzure.MobileServices.Backend.Entity

通過

工作再次在包管理器控制檯卸載軟件包WindowsAzure.MobileServices.Backend.Tables

uninstall-package WindowsAzure.MobileServices.Backend

然後

安裝封裝WindowsAzure.MobileServices.Backend -Version 1.0.342

安裝封裝WindowsAzure.MobileServices.Backend.Tables -Version 1.0.342

安裝封裝WindowsAzure。 MobileServices.Backend.Entity -Version 1.0.342

不知道爲什麼,這是後這裏發生的一切,雖然

+0

我仍然得到相同的錯誤,但使用Azure AD。嘗試了幾個版本,包括342和405,但沒有成功。這個問題在其他地方是否有任何反饋? – dmpontifex 2014-11-10 12:05:21

+0

我有同樣的問題。這完全與System.IdentityModel.Tokens.Jwt有關,它只會導致高於342的任何問題。MobileServices團隊沒有正確引用此dll。 – 2014-11-12 13:38:10

+1

只安裝WindowsAzure.MobileServices.Backend.Entity,因爲它會安裝其他:) – saramgsilva 2014-11-30 17:44:12

2

同樣的問題更新ams nuget pkg。 回滾工作,但它比解決方案更多的解決方法。

編輯:您可以回滾到405版本。

+0

您是否找到解決方案? – 2014-10-31 13:57:03

+0

還沒有。也發佈在[MSDN](https://social.msdn.microsoft.com/Forums/azure/en-US/5eae79c1-1580-4499-b890-f9d532fb3025/jwtsecuritytokenhandlersetcertificatevalidator-method-not-found?forum=azuremobile)論壇和[Git](https://github.com/Azure/azure-mobile-services/issues/463)問題,但尚未在任何地方回答。 – JeremyBP 2014-11-01 11:44:53

0

我的團隊仍在調查此問題,但我還沒有掌握所有信息,但到目前爲止,我已觀察到更新至439不會引發此問題。您可以通過在Visual Studio中創建一個新的移動服務,然後進入NuGet並將Mobile Services .NET後端實體框架軟件包更新到最新版本(439)來驗證這一點。 更新完成後,按F5,您應該看到服務正常加載,沒有任何錯誤。

我能夠通過選擇Microsoft.Owin.Security.ActiveDirectory包並將其從2.1.0更新到3.0.0來重現此問題。當然,在NuGet中選擇「全部更新」選項將實現相同的目標(還有更多)。

雖然我們繼續調查確切的修復應該是什麼,但是您能否確認升級到439而不升級到AD 3.0.0可以修復問題?

+0

我沒有升級Microsoft.Owin.Security.ActiveDirectory,但我確實升級了Microsoft.Owin.Cors,因此升級了Microsoft.Owin,而且我遇到了問題。我應該檢查其他任何軟件包嗎?我也升級了JWT軟件包。 – BoB 2014-12-02 05:54:15

4

好吧,我最終發現問題得益於保羅的建議。 這是因爲System.IdentityModel.Tokens.Jwt 4.0.0包的版本。

事實上,更新Microsoft.Owin.Security.ActiveDirectory包從2.1.0至3.0.0原因從3.0.2所述JWT包更新到4.0.0

解決方法是既ActiveDirectory的還原到2.1 .0和Jwt到3.0.2,然後打F5並享受AMS 439。

install-package System.IdentityModel.Tokens.Jwt -version 3.0.2 
+0

是的,這對我有效。 – BoB 2014-12-04 23:10:38

相關問題