毕业答辩ppt怎么做,杭州三墩镇大火,珠海公交线路查询
install-package microsoft.aspnet.webapi
install-package microsoft.owin.host.systemweb
install-package microsoft.aspnet.webapi.cors
配置webapi路由、跨域支持
public static class webapiconfig { public static void register(httpconfiguration config) { //跨域配置 config.enablecors(new enablecorsattribute("*", "*", "*")); //webapi路由 config.maphttpattributeroutes(); //设置webapi路由规则 config.routes.maphttproute( name: "areaapi", routetemplate: "api/{area}/{controller}/{action}/{id}", defaults: new { id = routeparameter.optional } ); config.routes.maphttproute( name: "webapi", routetemplate: "api/{controller}/{action}/{id}", defaults: new { id = routeparameter.optional } ); //移除xml返回格式数据 globalconfiguration.configuration.formatters.xmlformatter.supportedmediatypes.clear(); //配置返回的时间类型数据格式 globalconfiguration.configuration.formatters.jsonformatter.serializersettings.converters.add( new newtonsoft.json.converters.isodatetimeconverter() { datetimeformat = "yyyy-mm-dd hh:mm:ss" } ); } }
注册webapi
public class webapiapplication : system.web.httpapplication { protected void application_start() { arearegistration.registerallareas(); globalconfiguration.configure(webapiconfig.register); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); } }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论