问题
I have an action method which is working as I expect. Here is the code:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "Id,Title,Content,Category,HeaderFilePath")] Blog blog, HttpPostedFileBase upload)
{
if (ModelState.IsValid)
{
if (upload != null && upload.ContentLength > 0)
{
if (blog.HeaderFilePath != string.Empty && blog.HeaderFilePath != null)
{
try
{
System.IO.File.Delete(HttpContext.Server.MapPath("~/") + "images/" + blog.HeaderFilePath);
}
catch (Exception)
{
//TODO: handle it properly
//throw;
}
}
blog.HeaderFilePath = Guid.NewGuid() + ".jpg";
CustomHttpPostedFile f = new CustomHttpPostedFile(upload.InputStream, "jpg", HttpContext.Server.MapPath("~/") + "images/" + blog.HeaderFilePath);
f.SaveAs(HttpContext.Server.MapPath("~/") + "images/" + blog.HeaderFilePath);
}
db.Entry(blog).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(blog);
}
This Action method is doing its job no problem, Am I missing something?
The sign above the method body looks like "0 references | 1 request, 100% failed | 0 exceptions".
When i click on it it doesnt provide me any usefull information.
Edit: here is the screenshot showing no information for the failed request.
来源:https://stackoverflow.com/questions/40847828/application-insight-request-fails-even-though-the-code-is-working-properly