我想降级的.NET 4.0应用程序,以3.5和我有一个时间地狱试图定义一个路线:
I am trying to downgrade a .NET 4.0 app to 3.5 and I am having a hell of a time trying to define a route:
在4.0,它看起来是这样的:
In 4.0, it looks like this:
RouteTable.Routes.Add(new ServiceRoute("UploaderService",
new WebServiceHostFactory(), typeof(UploaderService)));
它看起来像.NET 3.5没有ServiceRoute对象。我失去了一些东西明显在这里?
It looks like .NET 3.5 does not have the ServiceRoute object. Am I missing something obvious here?
推荐答案
有一个在3.5 WCF路线不支持 - 这个功能在4.0中引入。在3.5,你不得不忍受的丑.SVC的URI的REST服务。
There's no support for WCF routes in 3.5 - this feature was introduced in 4.0. In 3.5 you have to live with the "ugly" .svc URIs for REST services.
因此,对于你提到的航线为例,你会添加一个名为像UploaderService.svc有以下内容的文件:
So for the route example you mentioned, you'd add a file called something like UploaderService.svc with the following content:
<%@ ServiceHost
Language="C#"
Debug="true"
Service="UploaderService"
Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
记住使用UploaderService的完全限定名,如果不是对的命名空间。而文件通常是一个单行文件,我只把它弄坏了下来这里为了提高可读性。
Remember to use the fully-qualified name of UploaderService, if it's not on the "" namespace. And the file is usually a single-line file, I only broke it down here for readability purposes.
相关推荐
最新文章