I have the following code in my startup.cs. Setting up the TokenEndpointPath works perfectly in IIS Express and when the Web API project is deployed to the root of a website in IIS. However, if I host in a nested application (i.e. an application within a website) in IIS calls to the token endpoint result in a 404. Is there a way to base the TokenEndpointPath off of the actual IIS structure instead of the root, as it does here? Right now:
This Works
This does not
http://server:80/app/api/token
var request = HttpContext.Current.Request;
app.UseOAuthAuthorizationServer(newOAuthAuthorizationServerOptions
{
AllowInsecureHttp = true,
TokenEndpointPath = newPathString("/api/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(oauthTokenTimeoutInMinutes),
Provider = new Provider.ActiveDirectoryAuthorizationServerProvider()
});
As commented, I have tested your issue by setting
TokenEndpointPath = new PathString("/api/Token")
. At first, myconnectionString
looks like the following:After publishing the project to Local IIS (7.5), getting 500 error response when sending POST request to
Then I updated
connectionString
like the following:It works like the following screenshot: