New file |
| | |
| | | using System; |
| | | using System.Linq; |
| | | using System.Net.Http.Formatting; |
| | | using System.Threading.Tasks; |
| | | using System.Web.Http; |
| | | using Microsoft.Owin; |
| | | using Owin; |
| | | using Swashbuckle.Application; |
| | | |
| | | [assembly: OwinStartup(typeof(HH.WCS.Mobox3.FJJT.Startup))] |
| | | |
| | | namespace HH.WCS.Mobox3.FJJT { |
| | | public class Startup { |
| | | public void Configuration(IAppBuilder app) { |
| | | // 有关如何配置应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkID=316888 |
| | | HttpConfiguration config = new HttpConfiguration(); |
| | | config.Routes.MapHttpRoute( |
| | | name: "DefaultApi", |
| | | routeTemplate: "api/{controller}/{action}/{id}", |
| | | defaults: new { id = RouteParameter.Optional } |
| | | ); |
| | | // Web API routes |
| | | //config.MapHttpAttributeRoutes(); |
| | | //config.EnableSwagger(c => c.SingleApiVersion("v1", "hh wms api")) |
| | | // .EnableSwaggerUi(); |
| | | //config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); |
| | | //config.Formatters.Add(new JsonMediaTypeFormatter()); |
| | | |
| | | |
| | | //WebApiConfig.Register(config); |
| | | // Web API routes |
| | | config.MapHttpAttributeRoutes(); |
| | | config.EnableSwagger(c => { |
| | | c.SingleApiVersion("v1", "hh wms api"); |
| | | c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + "\\HH.WCS.Mobox3.FJJT.xml"); |
| | | c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{System.AppDomain.CurrentDomain.BaseDirectory}\\HH.WCS.Mobox3.FJJT.xml")); |
| | | c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); |
| | | } |
| | | ).EnableSwaggerUi(c => { |
| | | c.InjectJavaScript(System.Reflection.Assembly.GetExecutingAssembly(), "swagger.js"); |
| | | }); |
| | | config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); |
| | | config.Formatters.Add(new JsonMediaTypeFormatter()); |
| | | |
| | | app.UseWebApi(config); |
| | | } |
| | | } |
| | | } |