Base solution for your next web application
Open Closed

Asp.net Core + Angular 2 :- HTTP Error 404 #2765


User avatar
0
thobiasxp created

Hi, Good Evening,

We have deployed client and server in different port  for Asp.net Core + Angular 2. When we refresh the page we are getting 404 error. 

Thanks


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

    Hi,

    Angular solution has as web.config file, please copy it to root of deployed angular app and it should solve your problem. Please let us know if it does not.

    Thanks.

  • User Avatar
    0
    thobiasxp created

    Hi,

    we copied angular solution web.config file in to the deployed angular app, we are getting 500.19 internal server error. we can host both server and client in separate port right or we need to merge both client and server for deployment.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes you can host them seperately and we suggest that. Probably you don't have url rewrite module installed for IIS in your local machine.

    This answer can help you <a class="postlink" href="http://stackoverflow.com/questions/35319942/url-rewrite-does-not-install-on-windows-10-iis-10">http://stackoverflow.com/questions/3531 ... -10-iis-10</a>. You can download IIS rewrite module here <a class="postlink" href="https://www.iis.net/downloads/microsoft/url-rewrite">https://www.iis.net/downloads/microsoft/url-rewrite</a>

  • User Avatar
    0
    thobiasxp created

    Hi, Good Morning,

    Thanks for your help, we tried by installing url rewrite module in IIS, but we got error in web config saying "<staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent>" We solved it by replacing static content with below code. So that now we are not getting refresh page error.

    We also tried by removing static content from webconfig. It also solved the issue of page refreshing error. So do we need to static content inside web config ?

    <staticContent>

    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00"/>

    <remove fileExtension=".css" /> <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" /> <remove fileExtension=".js" /> <mimeMap fileExtension=".js" mimeType="text/javascript; charset=UTF-8" /> <remove fileExtension=".json" /> <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" /> <remove fileExtension=".rss" /> <mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" /> <remove fileExtension=".html" /> <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" /> <remove fileExtension=".xml" /> <mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />

    <remove fileExtension=".mp3" /> <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> <remove fileExtension=".mp4" /> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> <remove fileExtension=".ogg" /> <mimeMap fileExtension=".ogg" mimeType="audio/ogg" /> <remove fileExtension=".ogv" /> <mimeMap fileExtension=".ogv" mimeType="video/ogg" /> <remove fileExtension=".webm" /> <mimeMap fileExtension=".webm" mimeType="video/webm" />

    <remove fileExtension=".svg" /> <mimeMap fileExtension=".svg" mimeType="images/svg+xml" /> <remove fileExtension=".svgz" /> <mimeMap fileExtension=".svgz" mimeType="images/svg+xml" />

    <remove fileExtension=".eot" /> <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> <remove fileExtension=".otf" /> <mimeMap fileExtension=".otf" mimeType="font/otf" /> <remove fileExtension=".woff" /> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> <remove fileExtension=".crx" /> <mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" /> <remove fileExtension=".xpi" /> <mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" /> <remove fileExtension=".safariextz" /> <mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />

    <remove fileExtension=".flv" /> <mimeMap fileExtension=".flv" mimeType="video/x-flv" /> <remove fileExtension=".f4v" /> <mimeMap fileExtension=".f4v" mimeType="video/mp4" /> </staticContent>

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Whe put this line "<staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent>" for Azure actually. By default, azure does not allow serving *.json files but we didn't have any errors locally.

    Anyway, thanks for your feedback, I'm sure someone else is going to face this problem in the future and this will be helpful :).

  • User Avatar
    0
    thobiasxp created

    Hi, Good Morning,

    Thanks for your kind and helpful support