![](/img/trans.png)
[英]DefaultAzureCredential fails for AzureAppConfiguration but works for SecretClient when running locally
[英]Kendo UI TreeListDataSource Read() only works when running locally
我有一个Kendo TreeList,其数据源定义为
var ds = new kendo.data.TreeListDataSource({
transport: {
read: {
url: "/Home/Read/",
type: "POST",
dataType: "json"
}},
schema:...
}
我的控制器的读取方法是:
[HttpPost]
public string Read()
{
log.Info("Start read()");
var vm = vmHelper.GetClientOrgListViewModel();
var json = new JavaScriptSerializer().Serialize(vm.FacilityList);
log.DebugFormat("json read returned: {0}", json);
return json;
}
只要我通过VS本地运行,一切都很好,但是一旦我部署到我们的登台服务器,Read()传输代码永远不会被执行。 我收到500错误。 按F-12查看IE中的请求显示500错误
关于它为什么在本地工作但不在服务器上以及如何解决此问题的任何想法或建议?
尝试使用@Url.Action("Read", "Home")
构建您的网址@Url.Action("Read", "Home")
var ds = new kendo.data.TreeListDataSource({
transport: {
read: {
url: '@Url.Action("Read", "Home")',
type: "POST",
dataType: "json"
}},
schema:...
}
如果您的javascript代码在javascript文件中,您将无法使用剃刀助手。 在这种情况下我做的是将它添加到我保存在我的布局文件中的URL列表中。 像这样:
<script type="text/javascript">
var Configuration;
(function (Configuration) {
var urls = {
Read: '@Url.Action("Read", "Home")'
}
Configuration.url = urls;
})(Configuration || (Configuration = {}));
</script>
然后将其用作:
transport: {
read: {
url: Configuration.url.Read
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.