<?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" />
<remove fileExtension=".md" />
<mimeMap fileExtension=".md" mimeType="text/markdown" />
<mimeMap fileExtension=".rtl" mimeType="text/css" />
</staticContent>
<!-- IIS URL Rewrite -->
<rewrite>
<rules>
<rule name="Force Https" enabled="true" stopProcessing="false">
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
<add input="{REMOTE_HOST}" pattern="localhost" negate="true" />
<add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Angular Routes" stopProcessing="false">
<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>
<outboundRules rewriteBeforeCache="true">
<rule name="Remove Server header">
<match serverVariable="RESPONSE_Server" pattern=".+" />
<action type="Rewrite" value="" />
</rule>
<rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
<match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
<conditions>
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
</conditions>
<action type="Rewrite" value="max-age=31536000" />
</rule>
</outboundRules>
</rewrite>
<httpProtocol>
<customHeaders>
<remove name="xxxx-Powered-By-xxx-yyyy" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Version is 8.0
This is the approach i am taking :
var userOuClaim = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == "Application_OrganizationUnitId");
if (AbpSession.UserId.HasValue && AbpSession.TenantId.HasValue)
{
var currentUserOrgId =
_cacheManager.GetCache(PSLConsts.UserOrganizationCache)
.GetOrDefault(AbpSession.UserId.Value.ToString() + AbpSession.TenantId.Value);
if (currentUserOrgId != null)
{
return Convert.ToInt32(currentUserOrgId);
}
if (string.IsNullOrEmpty(userOuClaim?.Value)) return null;
_cacheManager.GetCache(PSLConsts.UserOrganizationCache).Set(AbpSession.UserId.Value.ToString(), userOuClaim.Value);
return Convert.ToInt32(userOuClaim.Value);
}
if (AbpSession.UserId.HasValue && !AbpSession.TenantId.HasValue)
{
var currentUserOrgId =
_cacheManager.GetCache(PSLConsts.UserOrganizationCache)
.GetOrDefault(AbpSession.UserId.Value.ToString());
if (currentUserOrgId != null)
{
return Convert.ToInt32(currentUserOrgId);
}
if (string.IsNullOrEmpty(userOuClaim?.Value)) return null;
_cacheManager.GetCache(PSLConsts.UserOrganizationCache).Set(AbpSession.UserId.Value.ToString(), userOuClaim.Value);
return Convert.ToInt32(userOuClaim.Value);
}
I am somehow not convinced with the elegence of the solution. Is there a better way. The idea is to set the Orgid when the user changes the Org or fall back to Default orgID. This is applicable for Host and Tenant
The issue doesn't occur while I use localhost. Also I didn't had to use your code as I was able to get it running when I downloaded the 8.0 version isntead of using the latest version download button.
The issue is somwhere the code is making the IIS think it to be a html file instead of CSS file, so I get this error when I host it.
Resource interpreted as Stylesheet but transferred with MIME type text/html
I don't think it to be an IIS confi settings because I am hosting another application built out of ASPNet Zero ANgular abd .NET Core 2.0.
I suspect there is some malformed CSS tag or the way we are injecting the CSS code.
Did anyone else has this issue before ?
The issue was when you download using the latest button in the site this issues comes up. If you choose Version 8 the code that gets downloaded works fine.
I am not sure what's going on there. However I am able to load the site but having an issue with downloading the CSS
Error : Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://dev.pslplus.castandcrew.com/assets/primeng/datatable/css/primeng.datatable.min.css".
Note: In the same server I have hosted another Abp APP of an older version using .Net Core 2.0 and it works fine.
What has changed ?
Team -
We need to solve this at the earliest as it's kind of bottle neck for me. I deployed the code to Dev environment and it started throwing other kinds of error.
This doesn't work as I am getting Resource not found error when i login.
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR)GET - http://localhost:22742/api/TokenAuth/GetExternalAuthenticationProviders
Update : I provided Team Viewer access and the tech support was able to reproduce it in my system. I have also zipped the code and send it across.
Waiting for them to resolve and get back.
Please note I was able to work on this project till today until i downloaded a fresh copy
HTML1300: Navigation occurred. localhost:4200 (1,1)
[WDS] Live Reloading enabled.
WARN:
Could not find localization source: AbpWeb
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR)GET - http://localhost:22742/AbpUserConfiguration/GetAll?d=1575869001307
I am in the same boat. I downloaded a fresh copy and the angular application keeps failing to load and the below is the error message in the error log :
Unable to get URL from HttpRequest, fallback to null
DEBUG 2019-12-08 21:15:12,188 [16 ] HttpRequestEntityChangeSetReasonProvider - Unable to get URL from HttpRequest, fallback to null
No matter how many times i download the project it throws the same error. I cleared my browser cache restarted system and did everything ic ould.
Please provide a solution. I am also stuck and unable to move forward