.Net Core 应用程序中的 TinyMce - 上传后弹出窗口关闭

TinyMce in .Net Core App - Popup Closes after upload

我有一个 .net core 2.1 网站,我正在尝试集成 Tinymce 4 和文件上传过程。我使用 API 控制器上传文件。图像放在正确的文件夹中。问题是一旦上传完成,弹出窗口几乎立即关闭。在图像关闭之前,我确实设法获得了弹出窗口的屏幕截图。信息是正确的。

这是我的 TinyMce init.js 文件:

tinymce.init({
selector: "textarea.tinymce",
plugins: 'advlist autolink link image lists charmap print preview visualblocks',
toolbar: "link | image",
visualblocks_default_state: true,
images_upload_url: '/api/UploadService',
automatic_uploads: false,
images_reuse_filename: true,
images_upload_base_path: '/CMS/Content/UploadService/'
});

这是我的 API 控制器:

    [Produces("application/json")]
[Route("api/[controller]")]
public class UploadServiceController : Controller
{
    private IHostingEnvironment _hostingEnvironment;
    public UploadServiceController(IHostingEnvironment hostingEnvironment)
    {
        _hostingEnvironment = hostingEnvironment;
    }

    // GET: api/test
    [HttpGet]
    public IEnumerable<string> Get()
    {
        return new string[] { "value1", "value2" };
    }

    //[HttpPost, DisableRequestSizeLimit]
    public JsonResult UploadFile()
    {
        string fileName = "";
        string folderName = "CMS/Content/UploadService/";
        Microsoft.AspNetCore.Http.IFormFile file;
        try
        {
            file = Request.Form.Files[0];
            string webRootPath = _hostingEnvironment.WebRootPath;
            string newPath = Path.Combine(webRootPath, folderName);
            if (!Directory.Exists(newPath))
            {
                Directory.CreateDirectory(newPath);
            }
            if (file.Length > 0)
            {
                fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
                string fullPath = Path.Combine(newPath, fileName);
                using (var stream = new FileStream(fullPath, FileMode.Create))
                {
                    file.CopyTo(stream);
                }
            }
            return Json(new { location = $"{fileName}" });
        }
        catch (System.Exception ex)
        {
            return Json("Upload Failed: " + ex.Message);
            //return Json(@"HTTP / 1.1 500 Server Error + ex.Message");
        }
    }
  }
}

我不确定是什么导致 window 立即关闭,或者我需要添加什么来阻止它。

感谢任何帮助!

原来在 startup.cs 文件中我有 'app.UseBrowserLink();'

删除它会阻止页面重新加载,我可以单击“确定”按钮并插入我的图像。