Hi All,
I have created a WEBAPI (ASP.NET and using Microsoft.AspNet.OData packages to have a V4 version of OData.
In my own defined OData Controllers (based on stored procedures exposed via Entity Framework) I have Get Methods to retrieve data. I use annotation
[ODataRoute("GlobalProjectSearches?searchText={searchText}")]
In the webapi.config the controller is defined as:
modelBuilder.EntitySet<GlobalProjectSearch_Result>("GlobalProjectSearches")
.EntityType.Collection.Action("Get")
.ReturnsCollectionFromEntitySet<GlobalProjectSearch_Result>("GlobalProjectSearches")
.Parameter<string>("searchText");
That works OK and publishing to IIS is not a problem at all.
When running the project I can call the
GlobalProjectSearches
with or without the
searchText
parameter.
In IIS it shows an url like:
http://wrk2198:80/MarinServices/GlobalProjectSearches?searchText='Foo'
I have a website that connects to the OData webapi and when calling the
GlobalProjectSearches
it creates an URL Like
http://wrk2198:80/MarinServices/GlobalProjectSearches(searchText='Foo')
. That URL leads of course to a 404 error
What I have tried:
How can I have the proper URL created by the website when calling the connected service?
So why does my Website not stick to the OData route given to the controller?