【发布时间】:2017-02-28 18:02:03
【问题描述】:
每次我去这个视图时,我都会在从沙盒应用程序中获取客户列表时遇到这个错误。我正在使用 PaysimpleSDK https://github.com/PaySimple/PaySimpleSDK/wiki/Customer-Service
我的错误
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:PaySimpleSdk.Exceptions.PaySimpleEndpointException:端点错误:MethodNotAllowed:
var customers = await customerService.GetCustomersAsync(CustomerSort.FirstName);
这是我的控制器
public async Task<ActionResult> Trial()
{
string username = "myusername";
string apiKey = "apikey";
string baseUrl = "https://sandbox-api.paysimple.com/v4/customer";
var settings = new PaySimpleSettings( apiKey, username, baseUrl );
var customerService = new CustomerService(settings);
var customers = await customerService.GetCustomersAsync();
return View(customers.ToString());
}
我的视图(我无法复制整个视图代码,因为它有一个表格)
@model IEnumerable<PaySimpleSdk.Customers.Customer>
@{
ViewBag.Title = "Index";
}
@Html.DisplayNameFor(model => model.FirstName)
@foreach (var item in Model)
@Html.DisplayFor(modelItem => item.FirstName)
【问题讨论】:
-
如果你调试,错误出现在这一行:
customerService.GetCustomersAsync();或者它甚至没有进入Trial()动作?还是别的地方? -
看来您正在调用一个带有 http 动词(post, put, get...) 的方法不是该方法所期望的
-
@Alisson 出现错误,当我进入试用版时
-
@GhiniAntonio 我没有 http 动词
-
这个异常来自他们的库,所以我们根本帮不上忙。在their documentation 中查看您正在获取的
PaySimpleEndpointException。
标签: c# asp.net asp.net-mvc paysimple