2017-02-17 4 views
4

は私の認証設定は、私がサービスにIManageApiKeysの依存関係を解決しようとすると、それは型のオブジェクトをキャストするために、例外できませんスローなぜIManageApiKeys依存関係がServiceStack ApiKeyAuthProviderで解決されないのですか?ここ

Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { 
    new ApiKeyAuthProvider(AppSettings) { RequireSecureConnection = false, InitSchema = true}, 
    new CredentialsAuthProvider(AppSettings) 
    }) 
    { 
     IncludeRegistrationService = true, 

    }); 
container.Register<IAuthRepository>(c => new OrmLiteAuthRepository(dbFactory)); 
    container.Resolve<IAuthRepository>().InitSchema(); 

は「ServiceStack.Auth.OrmLiteAuthRepository」「ServiceStack.Authを入力します。 IManageApiKeys

var apiRepo = (IManageApiKeys)base.TryResolve<IAuthRepository>(); 

私はIManageApiKeysの依存関係を解決するために、それは(InitSchemaを通じてAPIKEYテーブルを作成しませんどのように把握することはできませんよ)しかしUSERAUTH、UserAuthDetailsとUserAuthRo leが作成されます。

+0

私はServiceStackを使用しています。バージョン4.0.60 – Anuj

答えて

2

OrmLiteAuthRepository does implement IManageApiKeysので、私はあなたのOrmLiteAuthRepositoryServiceStack.Server NuGetパッケージのだということを仮定しているがServiceStack NuGetパッケージと同じバージョンではありません。

/packagesフォルダーを確認し、異なるバージョンのプロジェクトがそれぞれ同じバージョンを参照するようにアップグレードする場合は、各ServiceStack依存関係が同じバージョン番号を参照するようにしてください。

+1

ありがとうございます@mythz、それは私の問題を解決しました。 – Anuj

関連する問題