Hi,
No I get the following exception instead:
An error occurred while sending the request.
at System.Net.Http.HttpConnection.SendAsyncCore (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x012d9] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:743
at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync (System.Net.Http.HttpConnection connection, System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x000e6] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:330
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync (System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x00101] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:296
at System.Net.Http.RedirectHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:32
at Microsoft.AspNetCore.Http.Connections.Client.Internal.AccessTokenHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ff] in <559e9e9efbf743acb6b2cd8b35a77f26>:0
at Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00095] in <559e9e9efbf743acb6b2cd8b35a77f26>:0
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered (System.Threading.Tasks.Task1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync (System.Uri url, System.Net.Http.HttpClient httpClient, Microsoft.Extensions.Logging.ILogger logger, System.Threading.CancellationToken cancellationToken) [0x00257] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x00080] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00180] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00127] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00091] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x00114] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x001bf] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 at System.Threading.Tasks.ValueTask
1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore (System.Threading.CancellationToken cancellationToken) [0x000a5] in <9b5c746cf3e24d3daddf4fedfbec16df>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner (System.Threading.CancellationToken cancellationToken) [0x001a4] in <9b5c746cf3e24d3daddf4fedfbec16df>:0
at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <9b5c746cf3e24d3daddf4fedfbec16df>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync (System.Threading.CancellationToken cancellationToken) [0x00091] in <9b5c746cf3e24d3daddf4fedfbec16df>:0
at Congresso.App.OnStart () [0x001c0] in C:\Repos\Congresso\src\Congresso.Mobile.Shared\App.xaml.cs:141
Managed to fix the previous problem and I'm getting the following exception when trying to connect to signalr
The SSL connection could not be established, see inner exception.
at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono.Net.Security.MonoSslAuthenticationOptions options, System.Threading.CancellationToken cancellationToken) [0x0025c] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:310 at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore (System.IO.Stream stream, System.Net.Security.SslClientAuthenticationOptions sslOptions, System.Threading.CancellationToken cancellationToken) [0x0007b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:165
When trying https://192.168.0.22:44301/signalr-document-conversion
HI @ismcagdas
I have tried disabling that line however when I startup my xamarin app whilst the mvc/host are running I get the following exception regardless of that line of code:
Call timed out: GET https://192.168.0.22:44301/AbpUserConfiguration/GetAll
at Flurl.Http.FlurlRequest.HandleExceptionAsync (Flurl.Http.FlurlCall call, System.Exception ex, System.Threading.CancellationToken token) [0x000e6] in C:\projects\flurl\src\Flurl.Http\FlurlRequest.cs:344
at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x00358] in C:\projects\flurl\src\Flurl.Http\FlurlRequest.cs:195
at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x00480] in C:\projects\flurl\src\Flurl.Http\FlurlRequest.cs:201
at Flurl.Http.ResponseExtensions.ReceiveJson[T] (System.Threading.Tasks.Task1[TResult] response) [0x00024] in C:\projects\flurl\src\Flurl.Http\ResponseExtensions.cs:24 at Congresso.ApiClient.AbpApiClient.ValidateAbpResponse[T] (System.Threading.Tasks.Task
1[TResult] httpResponse, System.Boolean stripAjaxResponseWrapper) [0x000d0] in C:\Repos\Congresso\src\Congresso.Application.Client\ApiClient\AbpApiClient.cs:372
My Web.Mvc is running on app url https://localhost:44302 My Web.Host is running https://localhost:44301
Hi,
I tried using the mobile profile on MVC and had no different result.
I am currently running 3 projects, HOST, MVC and DROID. The SignalR connection works fine for MVC to HOST but not DROID to HOST.
Hi,
I'm getting a git 404 error from that link.
Hi,
I'm trying to get a Signalr Client Hubconnection working on Xamarin but only receiving timeouts.
The Hubconnection works fine on the web application:
Information: Normalizing '/signalr-document-conversion' to 'https://localhost:44302/signalr-document-conversion'. WebSocket connected to wss://localhost:44302/signalr-document-conversion?id=b8_kizi_mCESajbklz7pyQ.
The Xamarin code:
` try { HubConnection = new HubConnectionBuilder() .WithUrl("https://192.168.0.22:44302/signalr-document-conversion" ).ConfigureLogging(logging => { logging.SetMinimumLevel(LogLevel.Debug); logging.AddConsole(); logging.AddDebug(); }) .Build();
HubConnection.On<int, int>("DocumentReordered", (documentId, newOrderIndex) =>
{
Console.WriteLine("TEST");
});
HubConnection.On<int, string, string, string>("DocumentStatusChanged", (documentId, status, fileName, fileTypeImageName) =>
{
Console.WriteLine("TEST");
});
await HubConnection.StartAsync();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
`
The log
` 08-03 12:46:59.476 I/mono-stdout(13938): Starting HubConnection. [40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[1] Starting HttpConnection. 08-03 12:46:59.481 I/mono-stdout(13938): [40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[1] 08-03 12:46:59.481 I/mono-stdout(13938): Starting HttpConnection. [0:] Microsoft.AspNetCore.Http.Connections.Client.HttpConnection: Debug: Starting HttpConnection. [40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[8] 08-03 12:46:59.493 I/mono-stdout(13938): [40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[8] Establishing connection with server at 'https://192.168.0.22:44302/signalr-document-conversion'. 08-03 12:46:59.493 I/mono-stdout(13938): Establishing connection with server at 'https://192.168.0.22:44302/signalr-document-conversion'. [0:] Microsoft.AspNetCore.Http.Connections.Client.HttpConnection: Debug: Establishing connection with server at 'https://192.168.0.22:44302/signalr-document-conversion'. 08-03 12:46:59.537 V/ViewRootImpl(13938): The specified message queue synchronization barrier token has not been posted or has already been removed 08-03 12:46:59.565 D/DecorView(13938): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@5231d85[MainActivity] [41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[10] Failed to start connection. Error getting negotiation response from 'https://192.168.0.22:44302/signalr-document-conversion'. System.Net.Http.HttpRequestException: Connection timed out ---> System.Net.Sockets.SocketException: Connection timed out at System.Net.Http.ConnectHelper.ConnectAsync (System.String host, System.Int32 port, System.Threading.CancellationToken cancellationToken) [0x000c8] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs:65 --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync (System.String host, System.Int32 port, System.Threading.CancellationToken cancellationToken) [0x00180] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/Sock 08-03 12:47:24.563 I/mono-stdout(13938): [41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[10]etsHttpHandler/ConnectHelper.cs:84 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ea] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:385 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync (System.Threading.Tasks.ValueTask1[TResult] creationTask) [0x000a2] in /Users/builder/jenkins/w
08-03 12:47:24.563 I/mono-stdout(13938): Failed to start connection. Error getting negotiation response from 'https://192.168.0.22:44302/signalr-document-conversion'.orkspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:543 at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at System.Net.Http.HttpConnectionPool.SendWithRetryAsync (System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x0003f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:284 at System.Net.Http.RedirectHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net
`
The Xamarin app is being run from a phone and the webhost is on a pc. I'm able to connect to all the other services from the phone just fine.
Prerequisites What is your product version? - v10.0.0 What is your product type (Angular or MVC)? - MVC What is product framework type (.net framework or .net core)? - Core
Anyone?
Hi @ismcagdas,
I wondered if you've had chance to take a look at this please?
I think we are very close and would be very greatful if you could cast your eye over what we are doing.
Thank you very much
Hi @ismcagdas
Apologies for bringing up such an old thread. However, we are trying to do exactly what @jfmeyers was describing several years ago, and introduce a setting whereby tenants can Allow Public Access to just some areas.
The easiest route we can see to achieving this is the create our own AbpAuthorizationFilter implementation which we have done:
public class PublicIfSetMvcAuthorizeFilter : AbpAuthorizationFilter
{
ITenantSettingsAppService _tenantSettingsAppService;
public CustomMvcAuthorizeFilter(IAuthorizationHelper authorizationHelper, IErrorInfoBuilder errorInfoBuilder, IEventBus eventBus, ITenantSettingsAppService tenantSettingsAppService) : base(authorizationHelper, errorInfoBuilder, eventBus)
{
_tenantSettingsAppService = tenantSettingsAppService;
}
public new async Task OnAuthorizationAsync(AuthorizationFilterContext context)
{
var setting = await _tenantSettingsAppService.GetAllowPublicAccessSettingAsync();
if (setting.AllowPublicAccess)
return;
await base.OnAuthorizationAsync(context);
}
}
We are then hoping to use a Custom MvcAuthorizeAttribute to mark methods that allow public access (when the setting is set to true) while leaving other methods using the original AbpMvcAuthorize which will always require the specified permission. For example:
[PublicIfSetMvcAuthorizeAttribute(AppPermissions.Pages_Teams)]
public ActionResult Index()
{
// If the global "Allow public access" setting is true, anyone can get here. Else, only allow people with AppPermissions.Pages_Teams allowed
}
[AbpMvcAuthorize(AppPermissions.Pages_Teams)]
public async Task<PartialViewResult> CreateOrEditTeamModal(int? id)
{
// Only allow people with AppPermissions.Pages_Teams allowed
}
We have created the PublicIfSetMvcAuthorizeFilter (as above). We have also created the PublicIfSetMvcAuthorizeAttribute:
public class PublicIfSetMvcAuthorizeAttribute : AbpMvcAuthorizeAttribute
{
public PublicIfSetMvcAuthorizeAttribute(params string[] permissions)
{
Permissions = permissions;
}
}
How do we set our new attribute so that it uses our new filter, while still leaving the original attribute using the original filter? At the moment when we use our new attribute it simply applies the original filter still.
Many thanks in advance,
Hi,
We are using string format to join two or more localisations together. For example:
<?xml version="1.0" encoding="utf-8" ?> <localizationDictionary culture="en"> <texts> <text name="CreateNewSomething">Create new {0}</text> <text name="Role">Role</text> <text name="OrganisationUnit">Organisation Unit</text> </texts> </localizationDictionary>
We are then using it these in our views like so:
string.Format(@L("CreateNewSomething"),@L("Role").ToLower())
This works great. However, we have now run into a problem trying to set the text for permissions in AppAuthorizationProvider.cs:
roles.CreateChildPermission(AppPermissions.Pages_Administration_Roles_Create, L("CreatingNewRole"));
The second parameter here expects ILocalizableString and not String. Therefore we cannot do a string format in the same way as above.
Is there a way to do this please?
Thanks,