S
Sai Pranav
Guest
Hi All,
I have created delete,put method using WebAPI. While calling the method from postman i am getting the method not allowed. I have done R&D and applied the changes but no luck. Please help me on this.
//[System.Web.Http.AcceptVerbs("GET", "POST","DELETE")]
//[System.Web.Http.HttpDelete]
public void Delete(int id)
{
using (EmployeeDBEntities entities = new EmployeeDBEntities())
{
entities.emps.Remove(entities.emps.FirstOrDefault(e=>id==e.id));
entities.SaveChanges();
}
}
settings in webconfig
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
Continue reading...
I have created delete,put method using WebAPI. While calling the method from postman i am getting the method not allowed. I have done R&D and applied the changes but no luck. Please help me on this.
//[System.Web.Http.AcceptVerbs("GET", "POST","DELETE")]
//[System.Web.Http.HttpDelete]
public void Delete(int id)
{
using (EmployeeDBEntities entities = new EmployeeDBEntities())
{
entities.emps.Remove(entities.emps.FirstOrDefault(e=>id==e.id));
entities.SaveChanges();
}
}
settings in webconfig
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
Continue reading...