Telerik RadAsynUpload VM293:3 Uncaught SyntaxError: Unexpected token < in JSON at position 2

Telerik RadAsynUpload VM293:3 Uncaught SyntaxError: Unexpected token < in JSON at position 2

我正在尝试使用 Telerik 的 AsyncUpload 文件。在我的本地开发机器中,Windows 7 和 Visual Studio 2015。我可以 select 一个文件并看到它正确上传。浏览器控制台没有错误提示。但是,如果我运行在2012 R2服务器上,会出现以下错误,无法上传文件。

VM293:3 Uncaught SyntaxError: Unexpected token < in JSON at position 2
    at JSON.parse (<anonymous>)
    at Function.m.parseJSON (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=AspScript_ScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ab7585254-495e-4311-9545-1f910247aca5%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3acb3d1a3e-7303-48dc-a612-61700f912203%3a16e4e7cd%3af7645509%3a22a6274a%3aed16cbdc%3a4877f69a%3a86526ba7%3a874f8ea2%3a88144a7a%3a24ee1bba%3a6d43f6d9%3ab7778d6c%3ae085fe68%3ac128760b%3a1e771326%3af46195d3%3a6b3f73b3%3a68f76a79%3a52af31a4%3a5fa37e7e%3a2a2fc429%3a92fe8ea0%3a19620875%3afa31b949%3a490a9d4e%3abd8f85e4:1505)
    at g.callback (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=AspScript_ScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ab7585254-495e-4311-9545-1f910247aca5%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3acb3d1a3e-7303-48dc-a612-61700f912203%3a16e4e7cd%3af7645509%3a22a6274a%3aed16cbdc%3a4877f69a%3a86526ba7%3a874f8ea2%3a88144a7a%3a24ee1bba%3a6d43f6d9%3ab7778d6c%3ae085fe68%3ac128760b%3a1e771326%3af46195d3%3a6b3f73b3%3a68f76a79%3a52af31a4%3a5fa37e7e%3a2a2fc429%3a92fe8ea0%3a19620875%3afa31b949%3a490a9d4e%3abd8f85e4:11452)
    at XMLHttpRequest.m (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=AspScript_ScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ab7585254-495e-4311-9545-1f910247aca5%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3acb3d1a3e-7303-48dc-a612-61700f912203%3a16e4e7cd%3af7645509%3a22a6274a%3aed16cbdc%3a4877f69a%3a86526ba7%3a874f8ea2%3a88144a7a%3a24ee1bba%3a6d43f6d9%3ab7778d6c%3ae085fe68%3ac128760b%3a1e771326%3af46195d3%3a6b3f73b3%3a68f76a79%3a52af31a4%3a5fa37e7e%3a2a2fc429%3a92fe8ea0%3a19620875%3afa31b949%3a490a9d4e%3abd8f85e4:11563)

当我点击VM293。显示如下内容,似乎json.parse试图解析html导致上传文件失败。


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>
    iESG
</title><link href="css/bootstrap.min.css" rel="stylesheet" /><link href="font-awesome/css/font-awesome.css" rel="stylesheet" /><link href="css/animate.css" rel="stylesheet" /><link href="css/style.css" rel="stylesheet" /></head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>
                <img src="images/logo.png" width="300" height="198" />
            </div>
            <h3><span id="uiAccessDeniedLabel">Error Occurred</span></h3>
            <a href="#" onclick="window.history.go(-2);">Back</a>
            <p class="m-t"> <small><span id="uiCopyrightStatement"></span></p>
            <small><a id="uiTerms">Terms</a></small> | <small><a id="uiPrivacy">Privacy</a></small>
        </div>
    </div>
    <script src="js/jquery-2.1.1.js"></script>
    <script src="js/bootstrap.min.js"></script>

</body>
</html>

请检查您的 Web.config 文件。这是一个工作片段示例。

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="2147483640"/>
    </system.web>
    <system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="2147483640"/>
            </webServices>
        </scripting>
    </system.web.extensions>
</configuration>

确保您授予上传文件夹中 IIS 用户的访问权限:

https://www.kbpublisher.com/kb/setting-up-folder-permissions-in-internet-information-services-(iis)_392.html