asp.net Web Api和移动应用程序

时间:2022-10-27 20:13:15

I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.

我只是想制作Android的电视指南以及其他一些移动平台。我想使用RSS更新来更新我的应用程序。在这个特定场景中,我想使用http://tvprofil.net/的RSS资源。我以为我可以从我的Android应用程序调用网站的RSS XML,解析它,显示,这就是故事的结尾。

But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.

但是,我的表兄告诉我,最好的办法是通过Asp.net Web Api服务。处理REST的东西。所以,如果我必须更改资源,喜欢某些iptv提供商的RSS我只会更改服务而不必处理我的移动应用程序。他说,其他优势是,如果我想构建Windows Phone应用程序或以相同方式工作的iOS应用程序,我会使用相同的服务为我做工作,并为这些应用程序创建UI和基本的东西。

The problem is that I have no idea how Asp.net web Api is used.

问题是我不知道如何使用Asp.net web Api。

Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.

任何人都可以给我一些有用的链接,甚至更好,写一个这个thig的例子。我只是希望来自http://tvprofil.net/的RSS通过Asp.Net Web Api服务,我可以调用服务并将其作为XML或......甚至是Json ...或者得到任何东西我的应用。

The whole thing is pretty confusing to me

整件事让我很困惑

1 个解决方案

#1


1  

If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).

如果RSS源有足够的数据供您的应用程序运行,那么您不需要ASP.NET Web Api。 ASP.NET Web Api在这种情况下可以扮演的唯一角色是它是否充当中间人。例如。您的客户端应用程序与您的服务器应用程序(ASP.NET Web Api)联系,后者又从实际的外部数据源(tvprofil.net RSS)中提取数据。

For completeness sake, a list of pro's and con's:

为了完整起见,我需要一份专家和骗子的清单:

Advantages of using an intermediate server

使用中间服务器的优点

  • Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
  • 可靠性。即使外部数据源处于脱机状态,您也可以缓存外部数据源的数据并提供该数据。此外,通过缓存数据,您可以将外部数据源上的负载减轻到最低限度。
  • Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
  • 转化性。您的中间服务器可以将外部数据源的数据转换为更适合您的客户端应用程序的另一种格式。当您有许多外部数据源,每个外部数据源都以其他格式提供数据时,这非常有用。您的中间服务器充当客户端应用程序的抽象层。

Disadvantages of using an intermediate server

使用中间服务器的缺点

  • More effort. It will take more effort to develop and host an intermediate server.
  • 更多的努力。开发和托管中间服务器需要更多的努力。
  • Reliability. You must ensure your intermediate server is online and connected to the internet 24/7
  • 可靠性。您必须确保您的中间服务器在线并连接到互联网24/7

#1


1  

If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).

如果RSS源有足够的数据供您的应用程序运行,那么您不需要ASP.NET Web Api。 ASP.NET Web Api在这种情况下可以扮演的唯一角色是它是否充当中间人。例如。您的客户端应用程序与您的服务器应用程序(ASP.NET Web Api)联系,后者又从实际的外部数据源(tvprofil.net RSS)中提取数据。

For completeness sake, a list of pro's and con's:

为了完整起见,我需要一份专家和骗子的清单:

Advantages of using an intermediate server

使用中间服务器的优点

  • Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
  • 可靠性。即使外部数据源处于脱机状态,您也可以缓存外部数据源的数据并提供该数据。此外,通过缓存数据,您可以将外部数据源上的负载减轻到最低限度。
  • Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
  • 转化性。您的中间服务器可以将外部数据源的数据转换为更适合您的客户端应用程序的另一种格式。当您有许多外部数据源,每个外部数据源都以其他格式提供数据时,这非常有用。您的中间服务器充当客户端应用程序的抽象层。

Disadvantages of using an intermediate server

使用中间服务器的缺点

  • More effort. It will take more effort to develop and host an intermediate server.
  • 更多的努力。开发和托管中间服务器需要更多的努力。
  • Reliability. You must ensure your intermediate server is online and connected to the internet 24/7
  • 可靠性。您必须确保您的中间服务器在线并连接到互联网24/7