0

I know this question seems similar to: This One or enter link description here but none of those solved my issue of my controller not responding to PUT while GET, POST, do .

Here's the PUT:

public void Put(int id, Node node)
    {}

So here's my web.config:

<system.web>
    <compilation debug="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.5.2"/>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
    </httpModules>   </system.web>   <system.webServer>
    <handlers>
      <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>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ApplicationInsightsWebTracking"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler"/>
    </modules>   </system.webServer>   <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>   </runtime>   <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>   </system.codedom> </configuration>

And my WebApiConfig.cs:

public static void Register(HttpConfiguration config)
    {
        // IoC registration setup
        UnityConfig.Register(config);

        // Web API routes
        config.MapHttpAttributeRoutes();

        config.Routes.MapHttpRoute(
            name: MTRouteName,
            routeTemplate: "MT/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
    }

enter image description here

Community
  • 1
  • 1
roboto1986
  • 624
  • 2
  • 13
  • 28
  • Hey roboto, in your code I missed the remove element of WebDav in handlers and modules, have you tried it? I was having this issue to POST method and removing WebDAV worked for me. Please take a look at http://stackoverflow.com/questions/6739124/iis-7-5-enable-put-and-delete-for-restful-service-extensionless . Regards. – dime2lo Oct 16 '16 at 15:41
  • Hi, yes I tried removing the web dav module and handler but still doesn't work. Any other suggestions ? – roboto1986 Oct 16 '16 at 17:46
  • also, webdav is disabled in my applicationhost.config – roboto1986 Oct 16 '16 at 20:10
  • Does it work if you add id to the URL and use the request body for the node parameter when issuing the request from Fiddler? – DavidS Oct 16 '16 at 23:22
  • Umm, err, yes it works .. I went through the wrong diagnosis to this problem. While the error seemed to be a well known error, it was actually something else. Unfortunately I have already spent a lot of time on it. Guess this one is a hard lesson learned. Should the question be closed? – roboto1986 Oct 17 '16 at 16:52
  • You can add as answer on what actually fixed the issue and mark it as answer. – Ravi A. Oct 19 '16 at 02:22

0 Answers0