c# - Make OData service work in IIS -


i have sample ms odata service. here's pertinent code:

        using (webapp.start(_baseaddress, configuration))         {...} 

and

    public static void configuration(iappbuilder builder)     {         httpconfiguration config = new httpconfiguration();         config.mapodataserviceroute(routename: "odata", routeprefix: "odata", model: getmodel());         builder.usewebapi(config);     } 

with

    private static iedmmodel getmodel()     {         odataconventionmodelbuilder builder = new odataconventionmodelbuilder();         builder.entityset<product>("products");         return builder.getedmmodel();     } 

this works , products controller great. i'm trying move on web project work in iis i'm getting blank document returned. i've managed trace line

builder.usewebapi(config); 

or @ least when comment line out gives same behaviour. sample https://aspnet.codeplex.com/sourcecontrol/latest#samples/webapi/odata/v4/odataopentypesample/ i'm trying use dynamicproperties on return objects.

here's code iis project webapiconfig:

        public static void register(httpconfiguration config)         {             // web api routes             config.maphttpattributeroutes();             config.mapodataserviceroute(routename: "odata", routeprefix: "odata", model: getmodel());         }          private static iedmmodel getmodel()         {             odataconventionmodelbuilder builder = new odataconventionmodelbuilder();             builder.entityset<product>("products");             var edmmodel = builder.getedmmodel();             return edmmodel;         } 

this sample https://aspnet.codeplex.com/sourcecontrol/latest#samples/webapi/odata/v4/odataactionssample/ on iis host, may want compare project it. , don't think config.maphttpattributeroutes(); needed.


Comments