我在做一些類似的...
public partial class ServiceHost : ServiceBase
{
private IDisposable _service;
public ServiceHost()
{
InitializeComponent();
}
public void Start(string[] args) { OnStart(args); }
protected override void OnStart(string[] args)
{
var options = new StartOptions("https://localhost:44331/");
_service = WebApp.Start(options, Configuration);
}
protected override void OnStop()
{
_service?.Dispose();
}
private static void Configuration(IAppBuilder app)
{
var factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get());
var idsrvOptions = new IdentityServerOptions
{
Factory = factory,
SigningCertificate = Cert.Load(),
AuthenticationOptions = new AuthenticationOptions
{
// This is where we configure External Identity Providers
IdentityProviders = ConfigureIdentityProviders
}
};
app.UseIdentityServer(idsrvOptions);
}
private static void ConfigureIdentityProviders(IAppBuilder app, string signInAsType)
{
}
}
Jpaull,在最初的時候,它是這種情況對我來說還有,它能夠更好地解決在IIS上部署,主要是證書和主機名問題的問題在那兒。發佈該錯誤並找到該解決方案。總之,即使您可以將IDS3作爲控制檯應用程序運行(樣本可在Identityserver3 GIT中使用)。從長遠來看,它總是更好地將其託管在IIS中。 – Sivalingaamorthy
只是來到這裏尋找答案的任何人的最終評論。我最終返回並在IIS中運行IdentityServer。我從來沒有完全解決我嘗試在Windows服務中運行時遇到的問題。 – jpaull