簡體   English   中英

無法從Angular中訪問服務器端控制器

[英]Cannot hit server side controller from Angular

當我嘗試使用angularJS調用服務器端控制器時,出現了這兩個錯誤消息。

The parameters dictionary contains a null entry for parameter 'problemId' of non-nullable type 'System.Guid' for method 'Boolean ReadOnly(System.Guid)'

[11:55:27 GMT+0000 (GMT Standard Time)] Browser Link: Failed to send message to browser link server:
Error: SignalR: Connection must be started before data can be sent. Call .start() before .send()

服務器端控制器我已經在此控制器上設置了一個斷點,但它從未受到攻擊。

public bool ReadOnly(Guid problemId)
        {
            var problem = new Problem(problemId);
            return problem.ProblemCompleted();
        }

Angular Controller Ive逐步完成了Angular,整個過程中我都有一個有效的GUID。

$scope.problemCompleted = stepService.readOnly($scope.problemId);

角度服務

//readOnly
this.readOnly = function (problemId) {
    $http.post(ROOT + '/step/ReadOnly/' + problemId)
   .then(function (result) {
       this.problemCompleted = result.data;
       return this.problemCompleted
   });
}

因此,我基本上希望將布爾值恢復到我的作用域內,但無法使用控制器。

public bool ReadOnly(Guid problemId)
        {
            var problem = new Problem(problemId);
            return problem.ProblemCompleted();
        }

新秀錯誤將問題ID更改為ID,它可以工作..對不起

public bool ReadOnly(Guid id)
        {
            var problem = new Problem(id);
            return problem.ProblemCompleted();
        }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM