title: AFNetworking 2.0 : error 503 when multipart POST
body: <p>I am using AFNetworking 2.1.0 to communicate between my iPad app and my server.</p>
  
  <p>I subclass AFHTTPSessionManager and use the following without problem :</p>
  
  <pre><code>[self POST:kAPIPath
  parameters:params
     success:^(NSURLSessionDataTask *task, id responseObject) {
                    successBlock(responseObject[@"result"]);
                }
     failure:^(NSURLSessionDataTask *task, NSError *error) {
                    failureBlock(error);
                }];
  </code></pre>
  
  <p>But when I add the multipart portion, my server returns</p>
  
  <blockquote>
    <p>request failure. error: Request failed: service indisponible (503)</p>
  </blockquote>
  
  <p>So this does not work :</p>
  
  <pre><code>[self POST:kAPIPath
  parameters:params
  constructingBodyWithBlock:^(id&lt;AFMultipartFormData&gt; formData) {
                  [formData appendPartWithFileData:uploadFile
                                              name:@"file"
                                          fileName:@"photo.jpg"
                                          mimeType:@"image/jpeg"];
                  }
     success:^(NSURLSessionDataTask *task, id responseObject) {
                    successBlock(responseObject[@"result"]);
                }
     failure:^(NSURLSessionDataTask *task, NSError *error) {
                    failureBlock(error);
                }];
  </code></pre>
  
  <p>But it also returns error 503 when I just do this (nothing modifying the formData) :</p>
  
  <pre><code>[self POST:kAPIPath
  parameters:params
  constructingBodyWithBlock:^(id&lt;AFMultipartFormData&gt; formData) {
  
                  }
     success:^(NSURLSessionDataTask *task, id responseObject) {
                    successBlock(responseObject[@"result"]);
                }
     failure:^(NSURLSessionDataTask *task, NSError *error) {
                    failureBlock(error);
                }];
  </code></pre>
  
  <p>or this (nil for the block):</p>
  
  <pre><code>[self POST:kAPIPath
  parameters:params
  constructingBodyWithBlock:nil
     success:^(NSURLSessionDataTask *task, id responseObject) {
                    successBlock(responseObject[@"result"]);
                }
     failure:^(NSURLSessionDataTask *task, NSError *error) {
                    failureBlock(error);
                }];
  </code></pre>
  
  <p>I read many posts, but can not understand where this can come from. The error 503 means</p>
  
  <blockquote>
    <p>503 Service Unavailable
    The server is currently unavailable (because it is overloaded or down for maintenance).[2] Generally, this is a temporary state. Sometimes, this can be permanent as well on test servers.</p>
  </blockquote>
  
  <p>But if I use the POST without the multipart, I have no problem. Does anyone have an idea where this could come from ?</p>
  
  <p>Thank you very much !!!</p>