Я создал этот REST API в Visual Studio 2019 in. net core и в классе контроллера, у меня есть следующий код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using RecLoadAPI.DAL;
namespace RecLoadAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class RecLoadPrimeController : Controller
{
public IActionResult Index()
{
return View();
}
[Route("RecLoadPrime/insertRecLoadData/{RecStartDate}/{RecEndDate}")]
[HttpPost]
public void insertRecLoadData(string RecStartDate, string RecEndDate)
{
RecLoadDataProvider dataProvider = new RecLoadDataProvider();
dataProvider.InsertCardsData(RecStartDate, RecEndDate);
}
}
}
Я пытаюсь протестировать свой код через Postman и я написал этот URL:
https://localhost:44306/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020
в Почтальоне, и я получаю сообщение об ошибке, в котором говорится, что Имя не определено. Я не уверен, что я делаю неправильно. Я очень плохо знаком с API REST. Ниже приведен снимок экрана Почтальона.
Ниже приведено изображение моего сценария PreRequest:
Скрипт Pre Requst теперь практически пустой. Сейчас я получаю другую ошибку:
HTTP Error 500.30 - ANCM In-Process Start Failure
Ниже приведена ошибка:
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title> HTTP Error 500.30 - ANCM In-Process Start Failure </title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
font-size: .813em;
color: #222;
background-color: #fff;
}
h1,
h2,
h3,
h4,
h5 {
/*font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;*/
font-weight: 100;
}
h1 {
color: #44525e;
margin: 15px 0 15px 0;
}
h2 {
margin: 10px 5px 0 0;
}
h3 {
color: #363636;
margin: 5px 5px 0 0;
}
code {
font-family: Consolas, "Courier New", courier, monospace;
}
body .titleerror {
padding: 3px 3px 6px 3px;
display: block;
font-size: 1.5em;
font-weight: 100;
}
a {
color: #1ba1e2;
text-decoration: none;
}
a:hover {
color: #13709e;
text-decoration: underline;
}
li {
margin: 5px;
}
</style>
</head>
<body>
<h1> HTTP Error 500.30 - ANCM In-Process Start Failure </h1>
<h2> Common causes of this issue: </h2>
<ul>
<li> The application failed to start </li>
<li> The application started but then stopped </li>
<li> The application started but threw an exception during startup </li>
</ul>
<h2> Troubleshooting steps: </h2>
<ul>
<li> Check the system event log for error messages </li>
<li> Enable logging the application process' stdout messages </li>
<li> Attach a debugger to the application process and inspect </li>
</ul>
<h2>
For more information visit:
<a href="https://go.microsoft.com/fwlink/?LinkID=2028265">
<cite> https://go.microsoft.com/fwlink/?LinkID=2028265 </cite></a>
</h2>
</body>
</html>
Любая помощь будет высоко оценена.