I'm using ASP.net core Boilerplate with angular. I tried hosting both apps individually website for Angular and website for .NET core under IIS localhost with no problem.
:
But When I want to deploy my App on public I encountered this problem :
1- I have only one public IP which is redirecting to the IIS Default Website and each app has a different port.
**So, Both Front-end and Back-end should be hosted under the IIS Default Website with a different port.
is that applicable with .NET core and Angular?**
Update
And here is my appsetting.json
{
"ConnectionStrings": {
"Default": "Server=localhost\\SQLEXPRESS; Database=MyDb;User Id=admin;Password=1234"
},
"App": {
"ServerRootAddress": "http://localhost:21021/",
"ClientRootAddress": "http://localhost:4200/",
"CorsOrigins": "http://localhost:4200,http://localhost:8080,http://localhost:8081,http://localhost:3000"
},
"Authentication": {
"JwtBearer": {
"IsEnabled": "true",
"SecurityKey": "MyApp_C421AAEE0D114E9C",
"Issuer": "MyApp",
"Audience": "MyApp"
}
}
}
Update 2
Angular web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
</staticContent>
<!-- IIS URL Rewrite for Angular routes -->
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Angular appconfig.production.json
{
"remoteServiceBaseUrl": "http://localhost:21021",
"appBaseUrl": "http://localhost:4200",
"localeMappings": [
{
"from": "pt-BR",
"to": "pt"
},
{
"from": "zh-CN",
"to": "zh"
},
{
"from": "he-IL",
"to": "he"
}
]
}