How do you use the Windsor-Castle WCFFacility with the WCF 4.0 REST services ?
当你没有文件时,你如何与工厂建立联系?
TIA
Søren
How do you use the Windsor-Castle WCFFacility with the WCF 4.0 REST services ?
当你没有文件时,你如何与工厂建立联系?
TIA
Søren
借助温莎3.0,这非常简单(如果我正确理解你的问题,如果我失踪的话,我会抱歉)。
显示你最简单的事是创建一种专人的申请,并确保你推荐:
如今界定了教育服务,如:
[DataContract]
public class Frob
{
[DataMember]
public string Name { get; set; }
[DataMember]
public string Fribble { get; set; }
}
[ServiceContract]
public interface IFrobService
{
[OperationContract]
[WebGet(UriTemplate = "/")]
IEnumerable<Frob> GetAllFrobs();
[OperationContract]
[WebGet(UriTemplate = "/{name}")]
Frob GetFrobByName(string name);
}
public class FrobService : IFrobService
{
private readonly List<Frob> _frobs
= new List<Frob>
{
new Frob {Name = "Foob", Fribble = "Soop"},
new Frob {Name = "Hoob", Fribble = "Soop"},
new Frob {Name = "Doob", Fribble = "Noop"}
};
public IEnumerable<Frob> GetAllFrobs()
{
return _frobs;
}
public Frob GetFrobByName(string name)
{
return _frobs
.FirstOrDefault(f =>
f.Name.Equals(name,
StringComparison.OrdinalIgnoreCase));
}
}
现在,你可以忽略这样的风化集装箱(而且由于这是一条独一无二的申请,我只想向你展示主要方法):
public static class Program
{
static void Main()
{
var container = new WindsorContainer();
container
.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero)
.Register(Component.For<IFrobService>()
.ImplementedBy<FrobService>()
.AsWcfService(new RestServiceModel("http://localhost/frobs")));
Console.ReadKey();
}
}
这是由卡斯温莎主办的WCF REST服务。
在“http:// localhost/frobs”上点一个浏览器,将接见所有浏览器,在“http:// localhost/frobs/Doob”上点一个浏览器。
im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...
I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...
We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...
I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...
friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?
I have written a pretty extensive REST API using Java Jersey (and JAXB). I have also written the documentation using a Wiki, but its been a totally manual process, which is very error-prone, ...
We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...
The Microsoft AJAX Library Preview 6 and jQuery provide several ways to make the sorts of calls I need: Sys.Net.WebRequest (ASP.NET Ajax) Sys.Net.WebServiceProxy (ASP.NET Ajax) $.ajax (jQuery) Sys....