troubleshooting Question

.Net Core URL Mapping Restful Web APIs

Avatar of Kyle Abrahams
Kyle AbrahamsFlag for United States of America asked on
.NET Programming* core mvcC#* ASP.NET Core
12 Comments1 Solution37 ViewsLast Modified:
Hi All,

I have .Net Core 3.1 Restful APIs that I'm trying to publish to IIS.  I've been messing with the routes and now broke something.

What I would like is to have the Controller for the service respond to whatever the application is.

I have a website in IIS.  I created an application called API.
Underneath API I'm trying to add my services as more applications.

So you can have something like <server>/API/HelpdeskService

Please note HelpdeskService is the Application name in IIS and NOT the controller.

Within the actual HelpdeskController I have a gets:

One for getTickets with 2 optional parameters, one for the creator and one for closed.  This should map to:
<server>/API/HelpdeskService    (By Default)

But I'm having issues passing in the parameters.

 app.UseEndpoints(endpoints =>

                    name: "Default",
                    pattern: "{controller}/{action}",
                    defaults: new { controller = "Helpdesk", action = "GetTickets" }

Open in new window

    public class HelpdeskController : BaseController

        public async Task<ActionResult<IEnumerable<TicketListDto>>> GetTickets(int? Creator = null, bool? closed = null)
           //closed parameter is null when hitting <server>/?closed=false and <server>/Helpdesk/GetTickets?closed=false
            var dto = await Mediator.Send(new GetTicketsQuery() { user= _currentUserService.user, CreatorId = Creator, Closed = closed });

            return dto.Tickets.ToList();

        public async Task<ActionResult<TicketDetailDto>> GetTicketByID(int ticketID)
            var dto = await Mediator.Send(new GetTicketByIdQuery() { user = _currentUserService.user, TicketID = ticketID });

            return dto.ticket;

Open in new window

How do I wire this up properly?
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros