在 VSCode 中调试基于无服务器的应用程序时,我的断点均未处于活动状态。
启动.json
{
"configurations": [
{
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"name": "Debug",
"port": 5858,
"request": "launch",
"runtimeArgs": [
"run-script",
"vscode:debug"
],
"runtimeExecutable": "npm",
"type": "node"
}
],
"version": "0.2.0"
}
Run Code Online (Sandbox Code Playgroud)
我的package.json
...
"scripts": {
...
"vscode:debug": "export SLS_DEBUG=* && node --inspect=5858 --debug-brk --nolazy ./node_modules/.bin/serverless invoke local -s local -f customerAlexa -p ./test/requests/FindAgent-First-GoodZip.json"
},
....
Run Code Online (Sandbox Code Playgroud)
当我从菜单中选择“开始调试”时,所有红色断点都会变成灰色,并且程序只会执行而不会在断点处停止。
我在 Mac 上运行 Node 6.11.2、Serverless 1.23.0。谢谢大家。
我在.Net 4.5中有一个oData应用程序.oData端点工作正常,但我想在控制器上创建自定义操作,以便在给定电子邮件地址时在Customer记录上设置标志.
这是我的客户端代码(使用AngularJS):
$http({
method: 'POST',
url: '/odata/Customers/SetAlertFlag',
data: { 'email': 'test@test.com'}
}).success(function (data, status, headers, config) {
// ...
}).error(function (data, status, headers, config) {
// ...
});
Run Code Online (Sandbox Code Playgroud)
这是我的服务器代码:
public class CustomersController : EntitySetController<Customer, int>
{
private DBEntities db = new DBEntities();
// ... other generated methods here
// my custom method
[HttpPut]
public Boolean SetAlertFlag([FromBody] string email)
{
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
永远不会调用服务器方法.当我在浏览器中输入此URL时,http://localhost:60903/odata/Customers/SetAlertFlag我收到此错误:"检测到无效操作."SetAlertFlag'不是可以绑定到'Collection([Skirts.Models.Customer Nullable = False])'的操作."
EntitySetController类可以没有自定义方法吗?我该怎么做呢?