具有数据访问功能的 WCF REST 服务模板 40 (CS) 示例

发布于 2024-12-02 16:56:24 字数 338 浏览 0 评论 0原文

我正在探索 Visual Studio 2010 中的在线模板:WCF REST 服务模板 40

有谁知道可以学习的优秀示例吗?或者至少为我指明正确的方向...... 我正在尝试创建一项从数据库查找 EmployeeID 的服务,以返回一些序列化的员工个人资料数据。

基本上,我想知道什么去了哪里(通过较新的方式,WCF 4.0,RESTful,Json)。 -连接字符串 -查询字符串 -etc

希望 URL 看起来像这样: http://localhost:55123/EmployeeService/EmployeeLookup/{EmployeeID}

我的下一个任务当然是在某个网页中使用该服务。

I am exploring the online template in Visual Studio 2010: WCF REST Service Template 40

Does anyone know of a great sample to learn from? Or at least point me the right direction...
I am trying to create a service of looking up a EmployeeID from a database to return some serialized employee profile data.

Basically, I wish to know what goes where (via the newer way, WCF 4.0, RESTful, Json).
-ConnectionString
-QueryString
-etc

Hoping the Url will look something like this:
http://localhost:55123/EmployeeService/EmployeeLookup/{EmployeeID}

My next task of course would be to consume the service in some webpage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汐鸠 2024-12-09 16:56:24

这个周末我刚刚浏览了这个 10 部分的示例(应该是 12 部分,但他们从未发布过最后 2 部分)。它使用数据库来检索任务和用户信息,并且可能会让您了解您正在尝试执行的操作。

我发现它非常有用且信息丰富,并且去年我一直在研究 SOAP WCF (3.5)。

简介.NET 4 中的 WCF WebHttp 服务

到目前为止发布的 10 个部分是:

1.  Getting Started with WCF WebHttp Services in .NET 4
2.  Clients and the Automatic Help Page in WCF WebHttp Services
3.  Updating State in WCF WebHttp Services
4.  Automatic and Explicit Format Selection in WCF WebHttp Services
5.  Error Handling in WCF WebHttp Services with WebFaultException
6.  Using Routes to Compose WCF WebHttp Services
7.  Integrating ASP.NET Output Caching with WCF WebHttp Services
8.  Returning Custom Formats from WCF WebHttp Services
9.  Creating Views in WCF WebHttp Services with T4
10.  Conditional GET and ETag Support in WCF WebHttp Services 

根据问题,前 4 个部分可能是您最感兴趣的,但是所有 10 个部分都很有价值并且内容丰富。

I just went through this 10 part sample this weekend (it's supposed to be 12, but they never posted the last 2). It uses a database to retrieve task and user info, and might give you a feel for what you're trying to do.

I found it very useful and informative, and I've been doing SOAP WCF (3.5) for the last year+.

Introducing WCF WebHttp Services in .NET 4

The 10 parts posted so far are:

1.  Getting Started with WCF WebHttp Services in .NET 4
2.  Clients and the Automatic Help Page in WCF WebHttp Services
3.  Updating State in WCF WebHttp Services
4.  Automatic and Explicit Format Selection in WCF WebHttp Services
5.  Error Handling in WCF WebHttp Services with WebFaultException
6.  Using Routes to Compose WCF WebHttp Services
7.  Integrating ASP.NET Output Caching with WCF WebHttp Services
8.  Returning Custom Formats from WCF WebHttp Services
9.  Creating Views in WCF WebHttp Services with T4
10.  Conditional GET and ETag Support in WCF WebHttp Services 

The first 4 will probably be of the most interest to you based on the question, but all 10 are valuable and informative.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文