question

Henrik1995 avatar image
0 Votes"
Henrik1995 asked Bruce-SqlWork commented

Running ASP.Net core on Tomcat for Rest-API

Hello,
i want to create a Rest-API between my program and a database. My task is it to use ASP.Net and Tomcat as the webserver.
I didnt find any good answer for this combination, but many comments say that it is not possible to run asp.net programs with apache tomcat.
In my opinion i should better use asp.net core with Microsoft IIS. Maybe someone can tell me the right or better way to implement it.

Thank you very much!

windows-apidotnet-aspnet-core-generaldotnet-aspnet-core-webapidotnet-ml-big-data
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZhiLv-MSFT avatar image
0 Votes"
ZhiLv-MSFT answered

Hi @HenrikWaschke-5013,

The Tomcat (Apache Tomcat) is Java exclusive, so it won't run anything .NET Core based.

To deploy and host the Asp.net core application, you can choose:

Refer this article: Host and deploy ASP.NET Core.

Then, after deploy and host the API application, you can access the API method in another application, such as a Java application.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Best regards,
Dillion

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered Bruce-SqlWork commented

For tomcat to host .net core you would use it as a reverse proxy, just as you would with Apache. Ngnix is a more common approach for a reverse proxy. In both cases you will need a startup application for the core app, like launchd.

If hosting .net core on windows, IIS is the common choice as it manages startup and error recovery.

Note: tomcat only natively hosts Java apps. You would configure .net core support similar to its node.js support.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, the answer down below from a microsoft employee says it is java exclusive. in case it works, would you recomment it or better use the IIS for company use?

0 Votes 0 ·

If hosting on windows, then IIS is probably the best choice. While IIS originally used reverse proxy to host asp.net core, it has improved hosting performance.

I’d only use tomcat if you needed to host both Java applications and asp.net on the same server, as it’s a lot more work to host asp.net core on tomcat, and not as performant.

0 Votes 0 ·