组织跨平台的Web服务的正确方法是什么?

时间:2022-05-27 02:57:00

May be my question is a bit ambiguous so I'll try to explain it clearly: Normally I work with ASP.NET MVC and write back-end for the websites. So 99% of data comes from the user's input to forms and sent to views.

可能是我的问题有点模棱两可,所以我会试着清楚地解释一下:通常我使用ASP.NET MVC并为网站编写后端。因此,99%的数据来自用户对表单的输入并发送到视图。

Now I would like to implement web-service based on ASP.NET : here what I want to do:

现在我想实现基于ASP.NET的Web服务:这里我想做的事情:

  • My mates write the same application on Android and iOS. I write web-site with the same functionality. The applications collect some data (inputs, Geo-locations, etc.) and should send it to the common DB (SQL Server).
  • 我的伙伴在Android和iOS上编写相同的应用程序。我用相同的功能编写网站。应用程序收集一些数据(输入,地理位置等),并将其发送到公共数据库(SQL Server)。

  • Respectively, web-service should send back some data.
  • 网络服务应分别发回一些数据。

I have no experience of writing service that get and post data to different platforms but have some idea how to do it: JSON or XML supported by all devices, so before post-get process I should convert data (no matter CLR, JVM, iOS) to JSON/XML and get\post (send, recieve) it.

我没有编写服务来获取和发布数据到不同平台的经验,但有一些想法如何去做:所有设备都支持JSON或XML,所以在post-get进程之前我应该​​转换数据(无论CLR,JVM,iOS )到JSON / XML并获得\ post(发送,接收)它。

I want to do it with hosting the server on Azure.

我想在Azure上托管服务器。

Could you prove that I am thinking on the right way or show what mistakes did I do? Is there any topics I need to learn? More clearly, here are the questions:

你能证明我正在以正确的方式思考或表明我做了什么错误吗?有什么话题我需要学习吗?更清楚的是,以下是问题:

  1. What should I learn in order to implement it?
  2. 我应该学习什么才能实现它?

  3. Is it good idea to use Azure\SQLServer with Android\IOS?
  4. 将Azure \ SQLServer与Android \ IOS一起使用是个好主意吗?

  5. Will I need to write my own API or there are ready solutions for cross platform communication (data-exchange)?
  6. 我是否需要编写自己的API或者有跨平台通信(数据交换)的现成解决方案?

1 个解决方案

#1


1  

You should learn ASP.NET Web API and not use a ASP.NET WCF web service. WCF is not cross platform compatible. Web API is because it is compatible with the REST (representational state transfer) architecture and all the platforms you mentioned can use REST for their calls to your RESTful API.

您应该学习ASP.NET Web API,而不是使用ASP.NET WCF Web服务。 WCF不是跨平台兼容的。 Web API是因为它与REST(代表性状态转移)体系结构兼容,并且您提到的所有平台都可以使用REST来调用RESTful API。

I don't see any reason why you shouldn't use Azure if that's what you're comfortable with. The Android\IOS applications will be talking to your RESTful API so the backend you use is not relevant to the consumer of you API.

我没有看到任何你不应该使用Azure的原因,如果这是你很满意的。 Android \ IOS应用程序将与您的RESTful API进行通信,因此您使用的后端与您的API消费者无关。

#1


1  

You should learn ASP.NET Web API and not use a ASP.NET WCF web service. WCF is not cross platform compatible. Web API is because it is compatible with the REST (representational state transfer) architecture and all the platforms you mentioned can use REST for their calls to your RESTful API.

您应该学习ASP.NET Web API,而不是使用ASP.NET WCF Web服务。 WCF不是跨平台兼容的。 Web API是因为它与REST(代表性状态转移)体系结构兼容,并且您提到的所有平台都可以使用REST来调用RESTful API。

I don't see any reason why you shouldn't use Azure if that's what you're comfortable with. The Android\IOS applications will be talking to your RESTful API so the backend you use is not relevant to the consumer of you API.

我没有看到任何你不应该使用Azure的原因,如果这是你很满意的。 Android \ IOS应用程序将与您的RESTful API进行通信,因此您使用的后端与您的API消费者无关。