Я пытаюсь настроить мою первую модель магистрали, которая реализует службы RESTful WCF. Вот что у меня есть: мой маршрутизатор создает модель пользователя, и я просто хочу выполнить fetch (). Я создал фиктивный веб-сервис, чтобы попытаться запустить его, прежде чем я исправлю свой фактический код WS.
РЕДАКТИРОВАТЬ: я считаю, что это проблема с моим web.config, не уверен, что мне нужно
МОЙ МАРШРУТИЗАТОР:
define([
'backbone',
'dashboard',
'models/UserModel'
],
function(Backbone, Dashboard, UserModel) {
var homeRouter = Backbone.Router.extend({
initialize : function() {
Backbone.history.start();
},
routes : {
'' : 'home',
'docs': 'docs'
},
'home' : function() {
var user = new UserModel({userId: 'cjestes'});
user.fetch();
},
'docs' : function() {
//load docs page
}
});
return new homeRouter();
});
Моя модель:
define([
'jquery',
'backbone'
],
function($, Backbone) {
//Docs Metro View
var userModel = Backbone.Model.extend({
userId: " ",
url: "services/User.svc/GetUserInformation",
initialize: function () {
this.userId = this.get("id");
}
});
// Return the Docs Model
return userModel;
});
МОЙ SVC:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Activation;
using System.Web.Hosting;
using System.Collections.Specialized;
namespace Mri.Dashboard.services
{
public class User : IUser
{
public string GetUserInformation()
{
return "hello";
}
}
}
МОЙ ИНТЕРФЕЙС
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
namespace Mri.Dashboard.services
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IUser" in both code and config file together.
[ServiceContract]
public interface IUser
{
[OperationContract]
string GetUserInformation();
}
}