繁体   English   中英

我在ASP.Net MVC中收到错误“Endpoint Error:MethodNotAllowed”

[英]I'm Getting an error “Endpoint Error: MethodNotAllowed” in ASP.Net MVC

每次我要访问此视图时,从沙箱ap中获取客户列表时出现此错误。 我正在使用PaysimpleSDK https://github.com/PaySimple/PaySimpleSDK/wiki/Customer-Service

我的错误

描述:执行当前Web请求期间发生未处理的异常。 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:PaySimpleSdk.Exceptions.PaySimpleEndpointException:Endpoint Error: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)

在mvc中我通常会在使用http get调用操作时出现此错误,并且已声明操作仅用于http post或者通常在为特定谓词声明操作时,并且您尝试使用不允许的操作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM