简体   繁体   English

如何创建WCF Web服务从WP8 App获取数据并将其发送到托管DB中的DB

[英]How to create a WCF Web service get data from WP8 App and send it to DB in a hosted DB

I worked on windows phone 8 App that the user can create a list of favorite places and this places will stored in a local DB in the phone. 我在Windows Phone 8 App上工作,该用户可以创建喜欢的地方的列表,并且这些地方将存储在手机的本地数据库中。 I need to make a hosted database that the App can store this places in it. 我需要创建一个托管数据库,应用程序可以在其中存储此位置。 I known from some developers that i can do this through WCF Web service but i don't know the real steps to create the WCF for this solution and hosted it to IIS server. 我从一些开发人员那里知道,我可以通过WCF Web服务执行此操作,但是我不知道为该解决方案创建WCF并将其托管到IIS服务器的真正步骤。

Thanks in advance 提前致谢

What you could do is to create endpoints around your DB operations, such as inserting a favorite place, deleting a favorite place, or updating a favorite place. 您可以做的是在数据库操作周围创建端点,例如插入收藏夹位置,删除收藏夹位置或更新收藏夹位置。 This endpoints will be called in your WP8 app. 该端点将在您的WP8应用程序中调用。 To call your endpoints you'll need to deploy your service. 要呼叫端点,您将需要部署服务。 Here you'll find a short tutorial on how to deploy a WCF service from Visual Studio to an IIS. 在这里,您将找到有关如何将WCF服务从Visual Studio部署到IIS的简短教程。 The creation of the service itself depends on your exact use case and how you'll do the mapping to the database (for example with Entity Framework with its code-first or database-first strategies). 服务本身的创建取决于您的确切用例以及如何映射到数据库(例如,使用具有代码优先或数据库优先策略的Entity Framework)。

As an alternative you could use ASP.NET Web API , which in my opinion is easier to use than WCF. 作为替代方案,您可以使用ASP.NET Web API ,我认为它比WCF更易于使用。 Another advantage is the RESTful architecture of Web API. 另一个优点是Web API的RESTful体系结构。 That allows you to call your service from almost all devices or platforms. 这样一来,您几乎可以从所有设备或平台上调用服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM