Reputation: 399
I developed a project using asp.net core MVC and cosmos db. When I try to post the form I got
HttpRequestException: An error occurred while sending the request error.
I debug it using break point.
await 'client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("HRDB", "EmployeesCollection"), employee);'
Above link so me the error. please help me to fix it .
code:
' [HttpPost]
public async Task<ActionResult> AddEmployee(Employee employee)
{
await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("HRDB", "EmployeesCollection"), employee);
return RedirectToAction("Employees");
}'
Error :
Upvotes: 0
Views: 3829
Reputation: 5294
I downloaded your code and tried to add an employee ,am getting the same error you are getting.
Below point to check :
Here is very simple and very nice article to get started with Azure cosmos DB in web application.
https://learn.microsoft.com/en-us/azure/cosmos-db/sql-api-dotnet-application
And finally start adding your model and add it.
Hope it helps.
Upvotes: 1