Base solution for your next web application
Open Closed

AppPath issues with Core under IIS Virtual Directory #4352


User avatar
1
jcompagnon created

Hello!

I'm running into some issues trying to get an MVC/Jquery Core 2.0 project running under a default local IIS site, as all content requests are looking at the IIS base site (localhost:80/) instead of the virtual app underneath (localhost/MyApp/).

Is there a suggested way to update the links for "view-resources", etc, without updating all href/src tags in the app?


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you set ApplicationPath to your virtual directory name in the constructor of this class <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/Views/AbpZeroTemplateRazorPage.cs">https://github.com/aspnetzero/aspnet-ze ... zorPage.cs</a> and see if it works ?

  • User Avatar
    0
    jcompagnon created

    Hello,

    According to the docs, the ApplicationPath has no setter; from the source, it looks like it's configured to return "/" by default. Should I just be creating a new Getter at this level, providing the project name we expect to see? Is that going to break other components?

    Thank you for your help!

  • User Avatar
    0
    alper created
    Support Team

    try to add the application as a new WEBSITE like below

  • User Avatar
    1
    jcompagnon created

    Hello Alper!

    Thanks for the suggestion. It does work when listed as its own site; my issue is that we're trying to have the app hosted under the same site as other projects - something like <a class="postlink" href="http://www.mydomain.com/">www.mydomain.com/</a>[project]. As we deal with many projects, we would like to keep this format consistent, if possible.

    After publishing to a directory exposed through IIS, trying to run the app loads the login page - but all of the resources (script, style, images, etc) return 404s, since they're expecting the "view-resources", etc, to be available at the site root - rather than at /[project]/.

    I was wondering if there was a central way to update what the app believed was site root, instead of having to update every reference to a resource.

    Do you have any hints as to how I might accomplish this, or a direction in which I can look?

  • User Avatar
    0
    alper created
    Support Team

    hi,

    You can track the problem in this issue => <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/724">https://github.com/aspnetzero/aspnet-ze ... issues/724</a> If you want to fix on your own;
    add a config for ApplicationPath and prepend this string to the faulty imports. the framework implementation will be in AbpRazorPage > ApplicationPath property. We might calculate the virtual path and prepend ApplicationPath to the imports. (in client-side you'll be using abp.appPath to retrieve this path.)

    <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/blob/master/src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/views/layout/layout.cshtml#L29">https://github.com/aspnetboilerplate/mo ... cshtml#L29</a>

    the default value is specified here <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/blob/41a139f75d1d5b76a0a7d66d69c078ec08e00455/src/AbpCompanyName.AbpProjectName.WebMpa/Abp/Framework/scripts/abp.js#L7">https://github.com/aspnetboilerplate/mo ... /abp.js#L7</a>

  • User Avatar
    0
    130servicing created

    sorry I have the same issue, but I think you resolved it before. I have tried also the suggestions in this page but didn't work! could be a problem of NPM or other package managers? please let me know if you have any other solution for that. thx