JS调用.net webapi提示405 (Method Not Allowed)?

最近笔者在一次项目中,去post后台(api在iis另一个程序上)会提示405 (Method Not Allowed)和Response for preflight has invalid HTTP status code 405

用swagger去直接调用发现没有任何问题,当时想到会不会是跨域问题,看了下webconfig发现有这么一个配置

    
      
      
      
      
     

把这段注释掉,再改一下httpProtocol这里的配置

    
      
        
        
        
        
      
     

你可能感兴趣的:(JS调用.net webapi提示405 (Method Not Allowed)?)