我正在使用 Azure 应用服务 .NET 后端和 Xamarin.iOS 应用程序。我能够成功注册新用户,并且可以在数据库中查看该用户的详细信息。我有一个自定义 ApiController,它处理注册,并且我能够通过成功的 POST 调用保存详细信息。
\n\n但是,当我尝试登录该应用程序时,出现以下错误:
\n\n{Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed. (Method Not Allowed) \nRun Code Online (Sandbox Code Playgroud)\n\n下面是我的代码:
\n\n后端成功进行 POST 调用的 RegistrationController
\n\n[MobileAppController]\n[RoutePrefix("api/register")]\n[AllowAnonymous]\npublic class RegisterController : ApiController\n{\n\n [HttpPost]\n [Route("newuser")]\n public HttpResponseMessage NewUser(RegistrationRequest request)\n {\n // Registration code in here\n\n }\n\n}\nRun Code Online (Sandbox Code Playgroud)\n\n这就是我在客户端调用此函数的方式:
\n\npublic async Task<Result<UserProfile>> RegisterUser(RegistrationWrapper registrationrequest)\n {\n try\n {\n var registrationRequest = new JObject();\n registrationRequest.Add("username", registrationrequest.username);\n registrationRequest.Add("password", registrationrequest.password);\n registrationRequest.Add("email", registrationrequest.email);\n registrationRequest.Add("phone", registrationrequest.phone);\n registrationRequest.Add("firstname", registrationrequest.firstname);\n registrationRequest.Add("lastname", registrationrequest.lastname);\n\n var result …Run Code Online (Sandbox Code Playgroud)