I am getting error while posting data from web API.
ExceptionMessage=Cannot insert explicit value for identity column in table 'Tbl_Menu' when IDENTITY_INSERT is set to OFF.
can anyone please tell how to resolve these error.
I am getting error while posting data from web API.
ExceptionMessage=Cannot insert explicit value for identity column in table 'Tbl_Menu' when IDENTITY_INSERT is set to OFF.
can anyone please tell how to resolve these error.
I Got Answer from my senior.
just change WebApiConfig File
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
to
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/**{action}**/{id}",
defaults: new { id = RouteParameter.Optional }
);
and use url for post data
http://localhost:14795/api/Guest/PostTbl_Menu