我正在使用<script src="https://www.gstatic.com/firebasejs/5.8.2/firebase.js"></script>
<script>
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
projectId: "<PROJECT_ID>",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
firebase.initializeApp(config);
</script>
版本2.2.0和Microsoft.AspNetCore.TestHost
版本15.9.0。我将IdentityServer4用于Jwt Bearer身份验证的OAuth2提供程序。与真实的Web服务器一起部署时,设置工作正常。但是,在使用Microsoft.NET.Test.Sdk
进行集成测试期间会发生此问题。
我已经像这样注册TestServer
:
HttpMessageHandler
private void InitializeServices<TStartup>(IServiceCollection services)
{
var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly;
var applicationPartManager = new ApplicationPartManager();
applicationPartManager.ApplicationParts.Add(new AssemblyPart(startupAssembly));
applicationPartManager.FeatureProviders.Add(new ControllerFeatureProvider());
applicationPartManager.FeatureProviders.Add(new ViewComponentFeatureProvider());
services.AddSingleton(applicationPartManager);
services.PostConfigure<IdentityServerAuthenticationOptions>(options =>
{
options.IntrospectionDiscoveryHandler = this.server.CreateHandler();
options.IntrospectionBackChannelHandler = this.server.CreateHandler();
options.JwtBackChannelHandler = this.server.CreateHandler();
});
}
是我的测试服务器。但是,当我运行集成测试时,出现以下错误。
this.server