Dotnet AWS无服务器API禁止返回403

问题描述

在无服务器部署中从我的模型填充模式对话框时,我一直遇到问题

我尝试了几种方法(均在本地工作),只有在部署时,我才能获得{“ message”:“ Forbidden”}

方法1将数据加载到局部视图中

 @*<script>
    $(function () {
        $('button.details').on('click',function () {
                $('.modal-body').load(`/geocert/asset?id=${$(this).data('id')}`);
            });
    })
</script>*@

方法2 json绑定

<script>
    $(function () {
        $('button.details').on('click',function () {
            $.getJSON(`/geocert/AssetAsJson?id=${$(this).data('id')}`).done(function (GeoCert) {
                $('#assetType').val(GeoCert.assetType);
                $('#company').val(GeoCert.company);
            });

        });
    })
</script>

方法背后的代码都是GET方法

 public async Task<PartialViewResult> OnGetAssetAsync(string id)
    {
        GeoCert = await _geoCertDynamo.GetCertificateToEdit(id,"DummyCompany");
        return Partial("_AssetDetails",GeoCert);
    }

    public async Task<JsonResult> OnGetAssetAsJsonAsync(string id)
    {
        GeoCert = await _geoCertDynamo.GetCertificateToEdit(id,"DummyCompany");
        return new JsonResult(GeoCert);
    }

我已经为此苦苦挣扎了大约一个星期,因此我们将不胜感激

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...