Web API Core | ComponentOne
ASP.NET Core Web API Edition / Working with Web API / Configuring Web API / Using ComponenOne template
In This Topic
    Using ComponenOne template
    In This Topic

    The ComponentOne Web API Edition is a set of API's that are available as Visual Studio templates with support for ASP.NET Core 2.0 and ASP.NET Core 3.0 Web API.

    This topic demonstrates how to create a Web API service application using ComponentOne template in Visual Studio. This builds the server side (or endpoint) for a client application. The client application sends a request to the endpoint for accessing its service and gets a response in return.

    1. Open Visual Studio, and select Create a new project to create a new Web API Core Service Project.
    2. In the Create a new project window, select C1 from the Project Types drop down and select C1 Web API Application for ASP.NET Core (.Net Framework).

    3. Set a Name and Location for your application.
    4. In the ComponentOne ASP.NET Web API Application Wizard, select the ASP.NET Core Framework version 3.0 and Web API Services according to your project requirements.

    5. You can also access data from a configured remote or local storage.
    6. Add runtime license to the application (for more information on how to add license to your WebAPI 3 application, refer to Licensing.
    7. Run the application in Visual Studio.

    In this new project, ComponentOne template adds the references C1.Web.Api.dll, C1.C1Excel.dll and other related assemblies.

    Note: To secure your data, you can customize the WebAPI project to configure security according to your requirements.


    Your server-side application is successfully created. You can now use the generated URL of launched Web API service to make a call to the service project from your client application. You can use Web API services such as Report, Excel, Image and Barcode in the client application. For more information, see Services topic.

    The following image shows a hosted Web API service application in browser.

    Web API Service Deployed

    In the example above, the service has been hosted at https://developer.mescius.com/componentone/demos/aspnet/c1WebAPI/latest/.

    Once you have successfully hosted a Web API URL for Services, you can access and call these Web API service for exporting and importing excel files, excel images, generate excel from given data and template, and generating barcode from a given text. For more information on how to work with Web API Services, see Services topic.

    Note: If you are using .Net Core 3.0 for creating a WebAPI app, the following lines of code get automatically added in the Startup.cs file of your application:
    public void ConfigureServices(IServiceCollection services)
    
     {
    
                ...
    
                services.AddC1Api();
    
     }
    
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
    
    {
    
                app.UseC1Api();
    
    ...
    
    }