c# - How to Debug a Post to an OWIN Service? -
i have owin self host service.
another service (which dont have access to) posting data on local network ip address (though computer name gives same results).
the problem have value 'null' in controller.
i've tried fiddler, cannot see traffic. know sending correct data, service (which cannot see) getting something.
from appbuilder.use() statement, know service being hit , navigate controller.
how can find out what's wrong or know going wrong please?
setup
public void owinwebserverconfiguration(iappbuilder appbuilder) { appbuilder.use(async (environment, next) => { //note: post hit can't find content of message debug.writeline(environment.request.uri); await next(); debug.writeline(environment.response.statuscode); }); // configure web api self-host. httpconfiguration config = new httpconfiguration(); // important - enable unity take control on di config.dependencyresolver = new helpers.unityresolver(_unitycontainer); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{content}", defaults: new { content = routeparameter.optional } ); var cors = new enablecorsattribute(owinconfig.allowedaccessurls, "*", "*"); //config.enablecors(new enablecorsattribute("*", "*", "get, post, options, put, delete")); config.enablecors(cors); appbuilder.usewebapi(config); }
controller
[httppost] public httpresponsemessage post(formcollection fc) { //fc, null. changing signature means controller not hit. httpresponsemessage response; // if (value != null) // system.diagnostics.debugger.log(0, "id:", value); response = request.createresponse(httpstatuscode.ok, "ok"); return response; }
screenshots
Comments
Post a Comment