Ios 将数据从iPhone发送到服务器

Ios 将数据从iPhone发送到服务器,ios,asp.net,swift,post,Ios,Asp.net,Swift,Post,我试图将数据从iphone(iOS8-Swift)发送到服务器(asp.net)。 目前,我可以从asp.net获取信息,但我无法从iPhone发布数据 这是我在Swift中发布的功能 let myUrl = NSURL(string: "http://192.168.0.79/JsonWcfService/GetEmployees.svc/json/InsertEmployee/"); //let myUrl2 = NSURL(fileURLWithPath: str) le

我试图将数据从iphone(iOS8-Swift)发送到服务器(asp.net)。 目前,我可以从asp.net获取信息,但我无法从iPhone发布数据

这是我在Swift中发布的功能

let myUrl = NSURL(string: "http://192.168.0.79/JsonWcfService/GetEmployees.svc/json/InsertEmployee/");

    //let myUrl2 = NSURL(fileURLWithPath: str)
    let request = NSMutableURLRequest(URL:myUrl!);
    request.HTTPMethod = "POST";

    // Compose a query string
    let postString = "name=James&lastname=Bond";

    request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding);

    let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
        data, response, error in

        if error != nil
        {
            println("error=\(error)")

            return
        }

        // You can print out response object
        println("response = \(response)")

        // Print out response body
        let responseString = NSString(data: data, encoding: NSUTF8StringEncoding)
        println("responseString = \(responseString)")

        //Let's convert response sent from a server side script to a NSDictionary object:

        var err: NSError?
        var myJSON = NSJSONSerialization.JSONObjectWithData(data, options: .MutableLeaves, error:&err) as? NSDictionary

        if let parseJSON = myJSON {
            // Now we can access value of First Name by its key
            var firstNameValue = parseJSON["firstName"] as? String
            println("firstNameValue: \(firstNameValue)")
        }

    }

    task.resume()
我在asp.net中的代码是:

   public interface IPostEmployees
{
    [OperationContract]
    [WebInvoke(Method = "POST",
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "json/InsertEmployee/{id1}/{id2}")]
    bool InsertEmployeeMethod(string id1, string id2);
}

我想发送名称和姓氏,2个参数,但显示错误: 状态代码:404 未找到结束

我做错了什么?谢谢


PD:根据本教程:

首先通过Web浏览器(例如Google Chrome的Postman扩展)测试服务器API通常是一种好的做法。然后,在客户端(例如iPhone)实现通信。您是否可以检查应用程序是否命中了API?通过在调试模式下在本地服务器/开发人员的计算机上使用log/running应用程序…我正在查找,我的文件web.config是错误的。。。但我不知道我该怎么办。谢谢你的帮助(邮递员是个很棒的应用,我不知道)
  public bool InsertEmployeeMethod(string id1, string id2)
   {

       int success = 0;
       using (SqlConnection conn = new SqlConnection("data source=SQLREPORTES;database=prueba;persist security info=True;user id=MYUSER;password=MYPASSWORD;multipleactiveresultsets=True;"))
       {
           conn.Open();

           //decimal value = Decimal.Parse(id3);
           string cmdStr = string.Format("INSERT INTO dbo.EmpDB VALUES('{0}','{1}')", id1, id2);
           SqlCommand cmd = new SqlCommand(cmdStr, conn);
           success = cmd.ExecuteNonQuery();

           conn.Close();
       }

       return (success != 0 ? true : false);
   }