当我尝试在 extjs 应用程序中使用 Web API 服务时,出现有关 无效 HTTP 状态代码 500 的错误。谁能告诉我为什么它会给我这个错误。我的商店代码如下:
Ext.define(`Demo.store.Users`, {
extend: `Ext.data.Store`,
model: `Demo.model.User`,
autoLoad: true,
proxy: {
type: `rest`,
url : `http://localhost:50893/Api/EmployeeService`,
reader: {
type: `json`
}
}
});
错误:
OPTIONS http://localhost:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25 500 (Internal Server Error)
Ext.define.request Connection.js?_dc=1388125117581:358
Ext.define.doRequest Ajax.js?_dc=1388125117534:271
Ext.define.read Server.js?_dc=1388125117566:198
Ext.define.load AbstractStore.js?_dc=1388125117034:869
Base.implement.callParent ext-debug.js:4263
Ext.define.load Store.js?_dc=1388125117503:1552
(anonymous function) ext-debug.js:2085
OPTIONS http://localhost:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25 Invalid HTTP status code 500
Ext.define.request Connection.js?_dc=1388125117581:358
Ext.define.doRequest Ajax.js?_dc=1388125117534:271
Ext.define.read Server.js?_dc=1388125117566:198
Ext.define.load AbstractStore.js?_dc=1388125117034:869
Base.implement.callParent ext-debug.js:4263
Ext.define.load Store.js?_dc=1388125117503:1552
(anonymous function) ext-debug.js:2085
XMLHttpRequest cannot load http://localhost:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25. Invalid HTTP status code 500
提前致谢
桑迪
最佳答案
也许...
商店默认使用 GET 方法发出请求,因此参数通过 url 传输,更改商店配置以使用 POST 方法。
在代理配置中放置以下内容:
actionMethods:{
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
}
关于javascript - 使用 extjs 存储中的代理从 Web API 服务获取数据的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20784593/