我想使用Swagger根据.Net WebApi和Owin for OAuth来记录我的api。 我使用Swashbuckle.Core Nuget Package并在我的启动类中配置swagger:
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
IContainer container = AutoFacConfig.Register(config, app);
app.UseCors(CorsOptions.AllowAll);
ConfigureOAuth(app, container);
WebApiConfig.Register(config);
AutoMapperConfig.Register();
config
.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "My API");
c.IncludeXmlComments(GetXmlCommentsPath());
})
.EnableSwaggerUi();
app.UseWebApi(config);
}
这是我的GetXmlCommentsPath方法
protected static string GetXmlCommentsPath()
{
return System.String.Format(@"{0}\bin\My.WebApplication.XML", System.AppDomain.CurrentDomain.BaseDirectory);
}
如果现在我启动我的应用程序,我会收到StackOverFlowException并且Swagger网站告诉我
Can't read from server. It may not have the appropriate access-control-origin settings.
我做错了什么?