Base solution for your next web application
Open Closed

Depoiement issue #4083


User avatar
0
dfielec created

Hello,

When we deploy our site on iis with *.Web.Host appsettings.json:

"App": { "ServerRootAddress": "http://www.domainname.com/SubDirectory/", "ClientRootAddress": "http://www.domainname.com/SubDirectory/", "CorsOrigins": "http://www.domainname.com/SubDirectory/" } without /SubDirectory/

thanks in advance


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

    Hi @DFIELEC,

    Does your angular app's configuration contains "/SubDirectory" for appBaseUrl ?

  • User Avatar
    0
    dfielec created

    <cite>ismcagdas: </cite> Hi @DFIELEC,

    Does your angular app's configuration contains "/SubDirectory" for appBaseUrl ?

    Hello, yes, it contains.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @DFIELEC,

    We actually haven't tested hosting AspNet Zero Angular2 UI in a sbudirectory. Now I have tested it and it does not work by default.

    First, you need to publish your angular app like this, <a class="postlink" href="https://github.com/angular/angular-cli/issues/4570#issuecomment-279050299">https://github.com/angular/angular-cli/ ... -279050299</a>.

    Then you need to change <base href="/"> to <base href="/subdirectory">.

    Also, loading the files under assets folder (appconfig.json & localized scripts) are not working, you need to add a subfolder prefix to them as well in your code.

  • User Avatar
    0
    abdourahmani created

    Hi !

    I have a similar problem when deploying my angular + core 2 web app (v5.0.4) to IIS.

    dotnet core 2 api app is ok. it starts automaticaly when I browse it.

    my customer want all his web apps on the same web server each in its sub directory under wwwroot.

    I followed what is recommanded in this thread with no luck.

    Building the app :

    ng build --env=prod --deploy-url=RapproDab/
    

    updated base href to /Rapprodab then got these errors : [attachment=2:1jq6wi6a]pic01.png[/attachment:1jq6wi6a]

    Then I replace all occurences of "RapproDab" in index.html file from "RapproDab/inline.bundle.js" to "./inline.bundle.js".

    which lead me to this :

    [attachment=1:1jq6wi6a]pic02.png[/attachment:1jq6wi6a]

    in the chrome console,

    [attachment=0:1jq6wi6a]pic03.png[/attachment:1jq6wi6a]

    This time I'm locked. No idea of what to do to resolve these errors.

    Please help.

    Abdourahmani

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @abdourahmani,

    There were some problems hosting AspNet Zero under a sub website, we have fixed it in this issue <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/740">https://github.com/aspnetzero/aspnet-ze ... issues/740</a>.

    You can implement changes in this issue to your project. Related commit contains the fix both for ASP.NET Core & jQuery and ASP.NET Core & Angular projects, so you need to ignore some of the changes.

    After that, publish your app like this:

    ng --prod --base-href "RapproDab"
    
  • User Avatar
    0
    abdourahmani created

    Hi !

    Here is what I got after applying the updates

    [attachment=1:3lft5bkq]pic04.png[/attachment:3lft5bkq]

    Could it be IIS config issues ? This is my first web app !

    [attachment=0:3lft5bkq]pic05.png[/attachment:3lft5bkq]

    Abdourahmani

  • User Avatar
    0
    ismcagdas created
    Support Team

    @abdourahmani, can you share a screenshot of your published app directory for angular ?

  • User Avatar
    0
    abdourahmani created

    Hi !

    Here is the IIS directory structure on server :

    [attachment=2:2qszsg8w]IIS Directories.png[/attachment:2qszsg8w]

    Inside RapproDab, copied from dist.

    [attachment=1:2qszsg8w]RapproDab.png[/attachment:2qszsg8w]

    Inside assets :

    [attachment=0:2qszsg8w]Assets.png[/attachment:2qszsg8w]

    Another point : If, as resqueted, I run

    ng --prod --base-href "RapproDab"
    

    I've got this error message

    The specified command --prod is invalid. For available options, see `ng help`.
    

    But

    ng build --env=prod --base-href "RapproDab"
    

    runs to completion.

    Regards,

    Abdourahmani

  • User Avatar
    0
    ismcagdas created
    Support Team

    @abdourahmani sorry it's my mistake, correct usage is "ng build --prod ...". So, is that solved your problem ? If not, we can arrange a remote meeting to understand your problem better.

  • User Avatar
    0
    abdourahmani created

    No, the problem is not solved. How can we setup this meeting ?

  • User Avatar
    0
    abdourahmani created

    Please, When is this meeting for ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    @abdourahmani please send an email to <a href="mailto:[email protected]">[email protected]</a> in order to arrange the meeting time.

  • User Avatar
    0
    abdourahmani created

    @ ismcagdas,

    I'm completely lost. 3 days I'm stuck on this issue. And the way you handle my requests is really frustating.

    I've sent the mail for the remote meeting and still no reaction.

    isn't there someone else who can help ?

    Abdourahmani

  • User Avatar
    0
    abdourahmani created

    Problem solved by upgrading to AspZero v5.1.0 and adding

    web.config

    <?xml version="2.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <httpErrors>   
                <remove statusCode="404" subStatusCode="-1" />                
                <error statusCode="404" path="/index.html" responseMode="ExecuteURL" />                
            </httpErrors>
            <staticContent>
                <mimeMap fileExtension=".json" mimeType="application/json" /> 
            </staticContent>
        </system.webServer>
    </configuration>
    

    Best regards, Abdourahmani

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @abdourahmani, I'm glad that you have solved your problem. Actually I have waited twice (monday and tuesday) for your response to connect to your computer but probably you forgot about our meetings.

    Anyway, happy coding :) We will try to serve you better next time.

  • User Avatar
    0
    abdourahmani created

    Hi !

    I also waited for you on these days. But I dont know how to get in touch with you. When I post a message, because of time difference (my local time is UTC+1) I only get a response the next day.

    what should I have to do to be available to you, next time ?

    Regards, Abdourahmani

  • User Avatar
    0
    ismcagdas created
    Support Team

    @abdourahmani most of the time we are trying to answer questions in the same day. For such kind of remote support, you can send email to <a href="mailto:[email protected]">[email protected]</a>.