Hi,
I added the CorsOrigins to the appsettings, but I need also to apply the following changes
<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/76">https://github.com/aspnetzero/aspnet-ze ... /issues/76</a>
After I did this change It works but I can't use my Tenancy_Name placeholder in the CorsOrigins property so I have to add every subdomain in the corsorigings property.
"App": {
"WebSiteRootAddress": "https://pm-{TENANCY_NAME}.myDomain.com/",
"CorsOrigins": "https://pm-Tenancy1.myDomain.com,https://pm-Tenancy2.myDomain.com,https://pm-Tenancy3.myDomain.com,https://pm.myDomain.com,https://pm-host.myDomain.com"
},
And finally it work.
Thank you very much for your help ! :)
Hi,
Have you got some example for an configuration in the appsettings ? I don't have any experience with cors.
Thanks !
Hi,
I tried to configure cors on the web config. I removed the '*' in the CORS settings from azure so there isn't any configuration. I changed the web.config and now I get the following error :
XMLHttpRequest cannot load <a class="postlink" href="https://pm-host.ligna-systems.com/signalr/negotiate?clientProtocol=1.5&enc_">https://pm-host.ligna-systems.com/signa ... l=1.5&enc_</a>…22abpcommonhub%22%7D%2C%7B%22name%22%3A%22chathub%22%7D%5D&_=1496148093643. The 'Access-Control-Allow-Origin' header contains multiple values 'https://pm-parts.ligna-systems.com, *', but only one is allowed. Origin 'https://pm-parts.ligna-systems.com' is therefore not allowed access.
This is my current web.config File, I put '*' on the 'Access-Control-Allow-Origin' property
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true"/>
<add name="Access-Control-Allow-Headers" value="X-Requested-With, origin, content-type, accept, Abp.TenantId, Authorization" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\LignaSystems.PM.Web.Host.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
<modules>
<remove name="WebDAVModule" />
</modules>
</system.webServer>
</configuration>
Hi,
Yes it works ! Thanks :D
But I have to put the whole jQuery Code inside the onShow()-Methode
onShown(): void { $(this.nameInput.nativeElement).focus();
$('.date').datepicker({
weekStart: 1,
format: "dd/mm/yyyy",
todayHighlight: true,
todayBtn: "linked"
});
$('#datumArbeitsverhaeltnisBeginn').datepicker().on("changeDate", e => {
let day = e.date.getDate();
let month = e.date.getMonth();
let year = e.date.getFullYear();
if (day > 0 && month > 0 && month < 13 && year > 1000) {
let d = new Date(Date.UTC(year, month, day));
this.newMitarbeiter.datumArbeitsverhaeltnisBeginn = moment(d);
}
});
$('#datumArbeitsverhaeltnisEnde').datepicker().on("changeDate", e => {
let day = e.date.getDate();
let month = e.date.getMonth();
let year = e.date.getFullYear();
if (day > 0 && month > 0 && month < 13 && year > 1000) {
let d = new Date(Date.UTC(year, month, day));
this.newMitarbeiter.datumArbeitsverhaeltnisEnde = moment(d);
}
});
}
Hi,
I published my angular 2 application to azure and its working only the chat doesn't work. If I look inside the console I get the following error:
XMLHttpRequest cannot load https://pm.host.ligna-systems.com/signalr/negotiate?clientProtocol=1.5&enc_…22abpcommonhub%22%7D%2C%7B%22name%22%3A%22chathub%22%7D%5D&_=1496057630510. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'https://parts.pm.ligna-systems.com' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
On my asp. core project (Abp v. 1.5.0) my webconfig looks like this :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Abp.TenantId, Authorization" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
<modules>
<remove name="WebDAVModule" />
</modules>
</system.webServer>
</configuration>
and on Azure I configured cors with a '*'.
Could you help my please ?
Any news ?
Hi,
I got some problems with the bootstrap datepicker. If I try the datepicker inside a component it worked. But If I used the datpicker inside a modal it doesn't work. If I change the date inside the modal the "changeDate"event wasn't triggered.
HTML
<div *ngIf="mitarbeiterJN">
<div class="form-group form-md-line-input no-hint">
<label>{{l("StartArbeitsverhaeltnis")}}</label>
</div>
<div class="input-group date" data-provide="datepicker" data-date-format="dd/mm/yyyy">
<input id="datumArbeitsverhaeltnisBeginn" type="text" name="datumArbeitsverhaeltnisBeginn" class="form-control">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
<div class="form-group form-md-line-input no-hint">
<label>{{l("EndeArbeitsverhaeltnis")}}</label>
</div>
<div class="input-group date" data-provide="datepicker" data-date-format="dd/mm/yyyy">
<input id="datumArbeitsverhaeltnisEnde" type="text" name="endeArbeitsverhaeltnis" class="form-control">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
.
.
.
</div>
Modal code
ngAfterViewInit() {
$('.date').datepicker({
weekStart: 1,
format: "dd/mm/yyyy",
todayHighlight: true,
todayBtn: "linked"
});
this.setDatePickerArbeitsverhaeltnisBeginn();
this.setDatePickerArbeitsverhaeltnisEnde();
}
setDatePickerArbeitsverhaeltnisBeginn() {
$('#datumArbeitsverhaeltnisBeginn').datepicker().on("changeDate", e => {
let day = e.date.getDate();
let month = e.date.getMonth();
let year = e.date.getFullYear();
if (day > 0 && month > 0 && month < 13 && year > 1000) {
let d = new Date(Date.UTC(year, month, day));
this.newMitarbeiter.datumArbeitsverhaeltnisBeginn = moment(d);
}
});
//$("#datumArbeitsverhaeltnisBeginn").datepicker('setDate', this.newMitarbeiter.datumArbeitsverhaeltnisBeginn.toDate());
}
setDatePickerArbeitsverhaeltnisEnde() {
$('#datumArbeitsverhaeltnisEnde').datepicker().on("changeDate", e => {
let day = e.date.getDate();
let month = e.date.getMonth();
let year = e.date.getFullYear();
if (day > 0 && month > 0 && month < 13 && year > 1000) {
let d = new Date(Date.UTC(year, month, day));
this.newMitarbeiter.datumArbeitsverhaeltnisEnde = moment(d);
}
});
//$("#datumArbeitsverhaeltnisEnde").datepicker('setDate', this.newMitarbeiter.datumArbeitsverhaeltnisEnde.toDate());
}
Could you help me please ?
Thanks !
Yes, it was related to a record inside the language table !
Thanks !! :)
Angular 2, asp.net core
Hi,
If I try to access the application with an other tenant as the host tenant I got an error: Request URL: <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> Internal Server Error
The tenant names I used is LIGNA-PARTS or LIGNA-WEB.
For a test I created a new tenant TEST-TENANT and with this tenant I can access the application without getting an error
Is there a problem with the tenant name ? But in earlier version I used the same tenant name and it works.
the logs
DEBUG 2017-05-04 10:45:46,100 [175 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - No information found on request to perform content negotiation. DEBUG 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-05-04 10:45:46,100 [175 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 34.1534ms DEBUG 2017-05-04 10:45:46,100 [175 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" completed keep alive response. INFO 2017-05-04 10:45:46,100 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 43.8301ms 500 application/json; charset=utf-8 INFO 2017-05-04 10:45:48,218 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> 0 DEBUG 2017-05-04 10:45:48,218 [175 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" completed keep alive response. INFO 2017-05-04 10:45:48,218 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.2333ms 204 INFO 2017-05-04 10:45:48,221 [189 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> application/json INFO 2017-05-04 10:45:48,221 [189 ] entication.JwtBearer.JwtBearerMiddleware - Successfully validated the token. INFO 2017-05-04 10:45:48,221 [189 ] entication.JwtBearer.JwtBearerMiddleware - HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer. DEBUG 2017-05-04 10:45:48,221 [189 ] NetCore.StaticFiles.StaticFileMiddleware - The request path /AbpUserConfiguration/GetAll does not match a supported file type DEBUG 2017-05-04 10:45:48,221 [189 ] Microsoft.AspNetCore.Routing.RouteBase - Request successfully matched the route with name 'defaultWithArea' and template '{area}/{controller=Home}/{action=Index}/{id?}'. DEBUG 2017-05-04 10:45:48,221 [189 ] .AspNetCore.Mvc.Internal.MvcRouteHandler - No actions matched the current request DEBUG 2017-05-04 10:45:48,221 [189 ] Microsoft.AspNetCore.Routing.RouteBase - Request successfully matched the route with name 'default' and template '{controller=Home}/{action=Index}/{id?}'. DEBUG 2017-05-04 10:45:48,225 [189 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) INFO 2017-05-04 10:45:48,235 [189 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) with arguments ((null)) - ModelState is Valid ERROR 2017-05-04 10:45:48,257 [177 ] Mvc.ExceptionHandling.AbpExceptionFilter - An item with the same key has already been added. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer1 comparer) at Abp.Localization.MultiTenantLocalizationDictionary.GetAllValuesFromDatabase(Nullable
1 tenantId) at Castle.Proxies.Invocations.MultiTenantLocalizationDictionary_GetAllValuesFromDatabase.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllValuesFromDatabase(Nullable1 tenantId) at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass3_0
2.<Get>b__0(String k) at Abp.Runtime.Caching.CacheBase.Get(String key, Func2 factory) at Abp.Runtime.Caching.CacheExtensions.Get[TKey,TValue](ICache cache, TKey key, Func
2 factory) at Abp.Localization.MultiTenantLocalizationDictionary.GetAllStrings(Nullable1 tenantId) at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllStrings_callback() at Castle.Proxies.Invocations.ILocalizationDictionary_GetAllStrings.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllStrings() at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetAllStrings(CultureInfo culture, Boolean includeDefaults) at Abp.Web.Configuration.AbpUserConfigurationBuilder.GetUserLocalizationConfig() at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetAll>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.<GetAll>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__40
1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() DEBUG 2017-05-04 10:45:48,257 [177 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - No information found on request to perform content negotiation. DEBUG 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-05-04 10:45:48,257 [177 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 33.812ms DEBUG 2017-05-04 10:45:48,257 [177 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" completed keep alive response. INFO 2017-05-04 10:45:48,257 [177 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 38.9717ms 500 application/json; charset=utf-8 DEBUG 2017-05-04 10:47:49,126 [166 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" disconnecting. DEBUG 2017-05-04 10:47:49,126 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" sending FIN. DEBUG 2017-05-04 10:47:49,126 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" sent FIN with status "0". DEBUG 2017-05-04 10:47:49,127 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" stopped. DEBUG 2017-05-04 10:47:49,204 [178 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" disconnecting. DEBUG 2017-05-04 10:47:49,204 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" sending FIN. DEBUG 2017-05-04 10:47:49,204 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" sent FIN with status "0". DEBUG 2017-05-04 10:47:49,205 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" stopped.
I found this error:
Error mapping types.
Mapping types: Permission -> FlatPermissionWithLevelDto Abp.Authorization.Permission -> LignaSystems.PM.Authorization.Permissions.Dto.FlatPermissionWithLevelDto
Type Map configuration: Permission -> FlatPermissionWithLevelDto Abp.Authorization.Permission -> LignaSystems.PM.Authorization.Permissions.Dto.FlatPermissionWithLevelDto
Property: DisplayName
Befor I can try the timeout I need to remove the error with the $("#...").<span style="color:#FF0000">select2</span> ({ ...})
Visual Studio said Property 'select2' does not exist on type 'JQuery'
How can I remove this error ?