简体   繁体   中英

Web Service or Windows Service

So good day to all.

I have a site and I want to make connection that can view our SQL Server (Windows SQL Server 2008). A programmer suggested to make a service. I don't know which one to use a windows service or a web service.

If I will be able to make a service how to apply it to my site? I have been searching about it but I can't find any resource.

If you guys have another solution in mind I would really appreciate it.

You can create a REST API that connects to the database and fetches you all the data that you need for your website., like

You can find simple examples on how a REST API can be created from this link.

And simultaneously you can fetch the data from the REST API like:

    static async Task<Uri> CreateProductAsync(Product product)
    {
        HttpResponseMessage response = await client.PostAsJsonAsync(
            "api/products", product);
        response.EnsureSuccessStatusCode();

        // return URI of the created resource.
        return response.Headers.Location;
    }

You can find complete example in this link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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