c# - OData no http resource was found that matches the request uri -
i'm having trouble getting odata service working mvc 4 site.
can me figure out i'm doing wrong?
here webapiconfig:
public static class webapiconfig { /// <summary> /// register method /// </summary> /// <param name="config">the config.</param> public static void register(httpconfiguration config) { config.mapodataserviceroute("odata", "odata", getedmmodel(), new defaultodatabatchhandler(globalconfiguration.defaultserver)); config.ensureinitialized(); } private static iedmmodel getedmmodel() { odataconventionmodelbuilder builder = new odataconventionmodelbuilder(); builder.namespace = "thisclassesnamespace"; builder.containername = "defaultcontainer"; builder.entityset<queryrequest>("queryrequests"); var edmmodel = builder.getedmmodel(); return edmmodel; } }
here global.asax's application_start method:
protected void application_start() { application["name"] = "administration web console"; globalconfiguration.configure(webapiconfig.register); arearegistration.registerallareas(); registerroutes(routetable.routes); error += mvcapplication_error; var maplayerdao = new maplayerdao(); maplayerdao.updateprovisioningdata(); var factory = new customcontrollerfactory(); controllerbuilder.current.setcontrollerfactory(factory); }
finally, here controler's method looks like
public class queryrequestscontroller : odatacontroller { private static odatavalidationsettings _validationsettings = new odatavalidationsettings(); private queryrequestdao dao = new queryrequestdao(); // get: odata/queryrequests [httpget] public ihttpactionresult getqueryrequests() { // validate query. try { // queryoptions.validate(_validationsettings); } catch (odataexception ex) { return badrequest(ex.message); } return ok<ienumerable<queryrequest>>(dao.getqueryrequests()); }
i can metadata fine @ http://10.78.14.177:8040/odata/
which gives me:
{ "@odata.context":"http://10.78.14.177:8040/odata/$metadata","value":[ { "name":"queryrequests","kind":"entityset","url":"queryrequests" }
] }
but when go http://10.78.14.177:8040/odata/queryrequests no http resource found matches request uri 'http://10.78.14.177:8040/odata/queryrequests'.
i think mvc routing getting request , not going odata service... i'm not sure fix is.
any ideas?
Comments
Post a Comment