0

Just deployed ASP.NET MVC5 web application to IIS 10. To do this, under "default website", I created a new application ("Add application"). I had to put in an alias so I put in "xyz".

So, now the public url is similar to http://xyz.mysite.com/xyz .... but I want it to be only http://xyz.mysite.com (remove 'xyz' subdirectory).

How can I do this?

The problem is that my ajax calls are failing because of the subdirectory.

1 Answer 1

1

You can do either of the following:

Option 1: Add Website in your IIS (instead of Add Application) and use the SNI feature. All relative path will be from root (/) level.

or

Option 2: Modify your AJAX calls to use @Url.Action("actionName", "controllerName") so your URLs will be generated properly based on relative path. I suspect you are hardcoding actionNames to "/controllerName/actionName" which uses root as your relative path.

Sign up to request clarification or add additional context in comments.

5 Comments

The @Url.Action helped specifically with all the failing AJAX calls. Thanks!
How do I set it up to use SNI?
Here is a sample steps on how to setup SNI: learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/… It is the Server Name Indication field in IIS.
Is SNI the only way to remove that "/audit" alias for this web app?
If your "Default Website" is not taken, then you can just disable that and "Add Website" that points to this web application. If the "Default Website" is taken and using the default port 80, you can "Add Website" with different port and point it to this web application. You will be using something like xyz.mysite.com:81 as your base URL for this web application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.