Magento API error --- SoapHeaderException: Procedure 'login' not present - soap

I am lost. I do not even know where to begin. This is the error I am getting:
Procedure 'login' not present
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Services.Protocols.SoapHeaderException: Procedure 'login' not present
Source Error:
Line 375: service.Url = account.APIURL;
Line 376:
Line 377: string sessionId = service.login(account.APIUser, account.APIPassword);
Line 378:
Line 379: var orders = service.salesOrderList(sessionId, InitialiseSOAPOrderCriteria(account.TriggerOrderStatus));
Source File: c:\inetpub\wwwroot\UAT.SFSystem\Settings\ChannelHeader.ascx.cs Line: 377
Stack Trace:
[SoapHeaderException: Procedure 'login' not present]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1772421
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +345
Adapters.MagentoSOAP.MagentoSOAP.MagentoService.login(String username, String apiKey) in C:\Work\WebCatch\SF\StoreFeeder\Middlewares\SFMWMagento\Adapters.MagentoSOAP\Web References\MagentoSOAP\Reference.cs:663
Settings_ChannelHeader.magentoTestConnection(String channelGuid) in c:\inetpub\wwwroot\UAT.SFSystem\Settings\ChannelHeader.ascx.cs:377
Settings_ChannelHeader.btnTestConnection_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\UAT.SFSystem\Settings\ChannelHeader.ascx.cs:154
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

I was getting the same error while using the v2 magento api, but problem resolved when I switched back to v1 soap api of magento

Related

Sustainsys.Saml2 not setting same site = none

We are using the v2.4 sustainsys.saml2 library and can't get the software to set the same site = none flag required by chrome 80. We get an error in the event viewer (reproduced below)
We are using .net V4.7.2 , windows server 2012 r2 and IIS. Our IdP has not yet implemented their fix for this issue. Could this be related?
Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 2/7/2020 9:43:02 AM
Event ID: 1309
Task Category: Web Event
Level: Warning
Keywords: Classic
User: N/A
Computer: WSATPWEB02
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 2/7/2020 9:43:02 AM
Event time (UTC): 2/7/2020 4:43:02 PM
Event ID: 5319961cdc244a7fb390e1d5d01d9014
Event sequence: 21
Event occurrence: 3
Event detail code: 0
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
at Sustainsys.Saml2.SameSiteHelper.DisallowsSameSiteNone(String userAgent)
at Sustainsys.Saml2.SameSiteHelper.EmitSameSiteNone(String userAgent)
at Sustainsys.Saml2.Configuration.Saml2Notifications.<>c.<.ctor>b__64_3(String userAgent)
at Sustainsys.Saml2.HttpModule.Saml2AuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: https://testportal.myatphub.ca:443/Saml2/SignIn?ReturnUrl=/Authservices
Request path: /Saml2/SignIn
User host address: 10.254.9.72
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\DefaultAppPool
Thread information:
Thread ID: 53
Thread account name: IIS APPPOOL\DefaultAppPool
Is impersonating: False
Stack trace: at Sustainsys.Saml2.SameSiteHelper.DisallowsSameSiteNone(String userAgent)
at Sustainsys.Saml2.SameSiteHelper.EmitSameSiteNone(String userAgent)
at Sustainsys.Saml2.Configuration.Saml2Notifications.<>c.<.ctor>b__64_3(String userAgent)
at Sustainsys.Saml2.HttpModule.Saml2AuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="ASP.NET 4.0.30319.0" />
<EventID Qualifiers="32768">1309</EventID>
<Level>3</Level>
<Task>3</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2020-02-07T16:43:02.000000000Z" />
<EventRecordID>101086</EventRecordID>
<Channel>Application</Channel>
<Computer>WSATPWEB02</Computer>
<Security />
</System>
<EventData>
<Data>3005</Data>
<Data>An unhandled exception has occurred.</Data>
<Data>2/7/2020 9:43:02 AM</Data>
<Data>2/7/2020 4:43:02 PM</Data>
<Data>5319961cdc244a7fb390e1d5d01d9014</Data>
<Data>21</Data>
<Data>3</Data>
<Data>0</Data>
<Data>/LM/W3SVC/1/ROOT-2-132255671020333604</Data>
<Data>Full</Data>
<Data>/</Data>
<Data>C:\inetpub\wwwroot\</Data>
<Data>WSATPWEB02</Data>
<Data>
</Data>
<Data>1864</Data>
<Data>w3wp.exe</Data>
<Data>IIS APPPOOL\DefaultAppPool</Data>
<Data>NullReferenceException</Data>
<Data>Object reference not set to an instance of an object.
at Sustainsys.Saml2.SameSiteHelper.DisallowsSameSiteNone(String userAgent)
at Sustainsys.Saml2.SameSiteHelper.EmitSameSiteNone(String userAgent)
at Sustainsys.Saml2.Configuration.Saml2Notifications.<>c.<.ctor>b__64_3(String userAgent)
at Sustainsys.Saml2.HttpModule.Saml2AuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
</Data>
<Data>https://testportal.myatphub.ca:443/Saml2/SignIn?ReturnUrl=/Authservices</Data>
<Data>/Saml2/SignIn</Data>
<Data>10.254.9.72</Data>
<Data>
</Data>
<Data>False</Data>
<Data>
</Data>
<Data>IIS APPPOOL\DefaultAppPool</Data>
<Data>53</Data>
<Data>IIS APPPOOL\DefaultAppPool</Data>
<Data>False</Data>
<Data> at Sustainsys.Saml2.SameSiteHelper.DisallowsSameSiteNone(String userAgent)
at Sustainsys.Saml2.SameSiteHelper.EmitSameSiteNone(String userAgent)
at Sustainsys.Saml2.Configuration.Saml2Notifications.<>c.<.ctor>b__64_3(String userAgent)
at Sustainsys.Saml2.HttpModule.Saml2AuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
</Data>
</EventData>
</Event>
That looks like a bug in the library, but you can work around it in your code.
The problem is in the default implementation of the EmitSameSiteNone notification. Could you please hook up your own implementation and see if that lets you troubleshoot? Is there a user agent string present in the request headers?

AspNetCore.Identity using PostgreSQL: how to create structure?

I have a ASP.NET Core web application with AspNetCore.Identity
Logins. It uses SQL Server for user authentication.
I need to use PostgreSQL database I have added some nuget packages (EF.* etc), changed the connection string and code
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
});
// options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection")));
services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql( Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddControllersWithViews()
.AddNewtonsoftJson();
services.AddRazorPages();
}
But when I run it, it connects to the PostgreSQL database and tries to create the structure I receive the error, what is wrong? Why EF cannot create the structure? How to solve this problem?
Executing endpoint 'WebApplication1.Controllers.HomeController.Index (WebA
pplication1)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
Route matched with {action = "Index", controller = "Home", page = "", area
= ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IAct
ionResult Index() on controller WebApplication1.Controllers.HomeController (WebA
pplication1).
info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[1]
Executing ViewResult, running view Index.
info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[4]
Executed ViewResult - view Index executed in 302.6169ms.
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed action WebApplication1.Controllers.HomeController.Index (WebAppli
cation1) in 315.3645ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'WebApplication1.Controllers.HomeController.Index (WebAp
plication1)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 451.9255ms 200 text/html; charset=utf-8
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET https://localhost:5001/Identity/Account/Logi
n
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint '/Account/Login'
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3]
Route matched with {page = "/Account/Login", area = "Identity", action = "
", controller = ""}. Executing page /Account/Login
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[101]
Executing handler method Microsoft.AspNetCore.Identity.UI.V4.Pages.Account
.Internal.LoginModel.OnGetAsync - ModelState is Valid
info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler[11
]
AuthenticationScheme: Identity.External signed out.
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[102]
Executed handler method OnGetAsync, returned result .
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[103]
Executing an implicit handler method - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[104]
Executed an implicit handler method, returned result Microsoft.AspNetCore.
Mvc.RazorPages.PageResult.
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4]
Executed page /Account/Login in 104.6291ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint '/Account/Login'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 157.5038ms 200 text/html; charset=utf-8
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 POST https://localhost:5001/Identity/Account/Log
in application/x-www-form-urlencoded 264
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint '/Account/Login'
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3]
Route matched with {page = "/Account/Login", area = "Identity", action = "
", controller = ""}. Executing page /Account/Login
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[101]
Executing handler method Microsoft.AspNetCore.Identity.UI.V4.Pages.Account
.Internal.LoginModel.OnPostAsync - ModelState is Valid
info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 3.1.0 initialized 'ApplicationDbContext' using provi
der 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: None
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (182ms) [Parameters=[#__normalizedUserName_0='?
'], CommandType='Text', CommandTimeout='30']
SELECT a."Id", a."AccessFailedCount", a."ConcurrencyStamp", a."Email", a."
EmailConfirmed", a."LockoutEnabled", a."LockoutEnd", a."NormalizedEmail", a."Nor
malizedUserName", a."PasswordHash", a."PhoneNumber", a."PhoneNumberConfirmed", a
."SecurityStamp", a."TwoFactorEnabled", a."UserName"
FROM "AspNetUsers" AS a
WHERE a."NormalizedUserName" = #__normalizedUserName_0
LIMIT 1
fail: Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred while iterating over the results of a query for cont
ext type 'WebApplication1.Data.ApplicationDbContext'.
Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does
not exist
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea
dMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown -
--
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea
dMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown -
--
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsumin
g)
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Bo
olean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavi
or, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade
rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance
llationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade
rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance
llationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade
rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance
llationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As
yncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationTok
en cancellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecuti
onStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 v
erifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As
yncEnumerator.MoveNextAsync()
Exception data:
Severity: ERROR
SqlState: 42P01
MessageText: relation "AspNetUsers" does not exist
Position: 294
File: parse_relation.c
Line: 1159
Routine: parserOpenTable
Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does not ex
ist
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa
geLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa
geLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean
async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, Ca
ncellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync
(RelationalCommandParameterObject parameterObject, CancellationToken cancellatio
nToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync
(RelationalCommandParameterObject parameterObject, CancellationToken cancellatio
nToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync
(RelationalCommandParameterObject parameterObject, CancellationToken cancellatio
nToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu
merator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken can
cellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStra
tegy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifyS
ucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu
merator.MoveNextAsync()
Exception data:
Severity: ERROR
SqlState: 42P01
MessageText: relation "AspNetUsers" does not exist
Position: 294
File: parse_relation.c
Line: 1159
Routine: parserOpenTable
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4]
Executed page /Account/Login in 2362.999ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint '/Account/Login'
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (18ms) [Parameters=[], CommandType='Text', CommandTimeo
ut='30']
SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_name
space n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory');
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 3019.116ms 500 text/html; charset=utf-8
I had to go a bit further than changing the provider and connection string.
In my ApplicationDbContext class:
First, I had an issue with Postgresql wanting to force double-quotes to be added to unquoted identifiers and automatically folding them to lower-case.
PostgreSQL Docs.
My solution was to install the EFCore.NamingConventions package. Then override OnConfiguring as shown below.
Identity 3.0 is apparently expecting the "dbo" schema to be used. Consequently, that needs to be specified by setting the default schema ("public" in this example and that is also the default for Postgresql) by overriding OnModelCreating.
Finally, the database table names need to be lower-cased which is handled by the for loop in the OnModelCreating override.
In the ApplicationDbContext class:
public class ApplicationDbContext
: IdentityDbContext<IdentityUser<int>,IdentityRole<int>,int>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSnakeCaseNamingConvention();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// PostgreSQL uses the public schema by default - not dbo.
modelBuilder.HasDefaultSchema("public");
base.OnModelCreating(modelBuilder);
//Rename Identity tables to lowercase
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
var currentTableName = modelBuilder.Entity(entity.Name).Metadata.GetDefaultTableName();
modelBuilder.Entity(entity.Name).ToTable(currentTableName.ToLower());
}
}
public DbSet<Address> Address { get; set; }
}
After doing this I added a new migration:
add-migration modifyIdentityForPostgresql
Then updated the database schema:
update-database
Which results in the Identity tables being created.
Screen clip of newly created Identity tables in Postgresql
You should run database migration after change provider and connect string , so that the asp.net core identity tables will create in your PostgreSQL database :
Add-Migration InitialCreate
Update-database
Document : https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=vs
My answer is similar to the one that #Steven Tomlinson provided, but in his solution ExampleTableName becomes exampletablename<string>, which I didn't really like as my goal was snake_case.
Create a Helper.cs class
public class Helper
{
public static string ToUnderscoreCase(string str)
{
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}
Install EFCore.NamingConventions
Edit ApplicationDbContext.cs:
public class ApplicationDbContext
: IdentityDbContext<IdentityUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSnakeCaseNamingConvention(); // Not even sure if this is used? it
didn't seem to make any difference
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("public");
base.OnModelCreating(modelBuilder);
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
var currentTableName = modelBuilder.Entity(entity.Name).Metadata.GetDefaultTableName();
if (currentTableName.Contains("<"))
{
currentTableName = currentTableName.Split('<')[0];
}
modelBuilder.Entity(entity.Name).ToTable(Helper.ToUnderscoreCase(currentTableName));
}
}
}

Connect-AzureRmAccount : accessing_ws_metadata_exchange_failed

I get the following error when attempting to connect to Azure using PowerShell. This account previously worked, but not sure what changed. Multi-factor authentication was enabled for organization, but this account should be excluded. This is an organizational account; not a Microsoft account. I have found similar errors online, but not this particular issue...
Connect-AzureRmAccount –Credential $Credential -Verbose
VERBOSE: Performing the operation "log in" on target "User account in environment 'AzureCloud'".
Connect-AzureRmAccount : accessing_ws_metadata_exchange_failed: Accessing WS metadata exchange failed: The underlying connection was closed: An unexpected error
occurred on a send.
At line:1 char:1
+ Connect-AzureRmAccount –Credential $Credential -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzureRmAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
I enabled Debug output for more information...
DEBUG: AzureQoSEvent: CommandName - Connect-AzureRmAccount; IsSuccess - False; Duration - 00:00:19.9521148; Exception - Microsoft.Azure.Commands.Common.Authentica
tion.AadAuthenticationFailedException: accessing_ws_metadata_exchange_failed: Accessing WS metadata exchange failed: The underlying connection was closed: An unex
pected error occurred on a send. ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: accessing_ws_metadata_exchange_failed: Accessing WS me
tadata exchange failed ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Una
ble to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existin
g connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper.<GetResponseSyncOrAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.IdentityModel.Clients.ActiveDirectory.MexParser.<FetchMexAsync>d__4.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask[T](Task`1 task)
at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.DoAcquireToken(AdalConfiguration config, PromptBehavior promptBehavior, Action`1 promptActi
on, String userId, SecureString password)
at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.SafeAquireToken(AdalConfiguration config, String showDialog, Action`1 promptAction, String
userId, SecureString password, Exception& ex)
--- End of inner exception stack trace ---
at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.AcquireToken(AdalConfiguration config, String promptBehavior, Action`1 promptAction, String
userId, SecureString password)
at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.GetAccessToken(AdalConfiguration config, String promptBehavior, Action`1 promptAction, Stri
ng userId, SecureString password, String credentialType)
at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String ten
ant, SecureString password, String promptBehavior, Action`1 promptAction, IAzureTokenCache tokenCache, String resourceId)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, Se
cureString password, String promptBehavior, Action`1 promptAction)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.ListAccountTenants(IAzureAccount account, IAzureEnvironment environment, SecureString passwo
rd, String promptBehavior, Action`1 promptAction)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantId, String subscrip
tionId, String subscriptionName, SecureString password, Boolean skipValidation, Action`1 promptAction, String name)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass83_0.<ExecuteCmdlet>b__0(AzureRmProfile localProfile, RMProfileClient profile
Client, String name)
at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 11:22:02 AM - ConnectAzureRmAccountCommand end processing.
DEBUG: 11:22:02 AM - ConnectAzureRmAccountCommand end processing.
The issue was that the Connect-AzureRMAccount cmdlet used TLS 1.0 by default. Centrify disabled TLS 1.0 support which caused the authentication attempts to close connection. The issue was resolved by adding the following to the PowerShell scripts to force TLS 1.2 security protocol:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

MVC3 Web Project Error: "An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128"

I published my MVC3 web project to Azure. When I tried to authorize with fb, I get an error below.
Additional info:
callbackUrl = http://site.azurewebsites.net/Facebook/AddSocialAccount
аuthenticateUrl = https://graph.facebook.com/oauth/authorize?client_id=*&response_type=code&redirect_uri=http%3A%2F%2Fsite.azurewebsites.net%2FFacebook%2FAddSocialAccount&scope=publish_stream%2Cemail%2Cuser_birthday
so the app authorizes on fb, goes to AddSocialAccount action and fails int the string:
var profile = this.Provider.GetUserProfile(code);
where goes to:
protected override Task<AccessGrant> PostForAccessGrantAsync(string accessTokenUrl, NameValueCollection request)
{
return this.RestTemplate.PostForObjectAsync<NameValueCollection>(accessTokenUrl, request)
.ContinueWith<AccessGrant>(task =>
{
string expires = task.Result["expires"];
return new AccessGrant(task.Result["access_token"], null, null, expires != null ? new Nullable<int>(Int32.Parse(expires)) : null);
});
}
and string with error is
string expires = task.Result["expires"];
Error:
Server Error in '/' Application.
enter code here
An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 10.10.0.1:3128]
System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +6462061
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +271
[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) +2233126
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) +14
Spring.Http.Client.WebClientHttpRequest.ExecuteRequestCallback(IAsyncResult result) in f:\bamboo-home\xml-data\build-dir\SPRNETREST-RELEASE-JOB1\src\Spring.Rest\Http\Client\WebClientHttpRequest.cs:246
[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3548265
System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +73
System.Threading.Tasks.Task`1.get_Result() +10486829
Project.Social.Facebook.Api.Impl.FacebookOAuth2Template.<PostForAccessGrantAsync>b__0(Task`1 task) in D:\Code\Poll\Project.Social\Facebook\Api\Impl\FacebookOAuth2Template.cs:23
System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() +81
System.Threading.Tasks.Task.Execute() +49
[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3548265
System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +73
System.Threading.Tasks.Task`1.get_Result() +10486829
Project.Social.Base.OAuth2SocialProvider`4.SetAccessToken(String code) in D:\Code\Poll\Project.Social\Base\OAuth2SocialProvider.cs:49
Project.Social.Base.OAuth2SocialProvider`4.GetServiceClient(String oauth_verifier) in D:\Code\Poll\Project.Social\Base\OAuth2SocialProvider.cs:66
Project.Social.Facebook.FacebookProvider.GetUserProfile(String oauth_verifier) in D:\Code\Poll\Project.Social\Facebook\FacebookProvider.cs:26 Project.Areas.FrontEnd.Controllers.ControllersBase.OAuthControllerBase`3.AddSocialAccount(String code, String oauth_verifier) in D:\Code\Poll\Project\Areas\FrontEnd\Controllers\ControllersBase\OAuthControllerBase.cs:112
lambda_method(Closure , ControllerBase , Object[] ) +147
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +214
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
System.Web.Mvc.Controller.ExecuteCore() +106
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +48
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
When I use local computer with connectionString of Azure I don't get this error(I change the domain and url on fb).
Thanks for any ideas!
I fixed this problem. There was the default proxy in my web.config.
<system.net>
<defaultProxy>
<proxy usesystemdefault="True" proxyaddress="http://10.10.0.1:3128" bypassonlocal="True" />
</defaultProxy>
I removed it. And authorization works correct.

RPXLib.dll throwing the exception The remote server returned an error: (500) Internal Server Error

I am trying to build the site login facility as single sign on. some how I come across to the site Janrain where I found the API's to do so. also I am trying this in my asp.net MVC application. so that I was following the steps given over here
I followed exact steps what are given, so I think no need to give code here. But In my action as:
public bool signin(string token)
{
// string token = token_url;
RPXLib.RPXService service = new RPXLib.RPXService(new RPXLib.RPXApiSettings("https://singlesignontest.rpxnow.com/api/v2/auth_info", "56fd9a76a5da4dffb9a437fe09564544b209c622"));
try
{
RPXLib.Data.RPXAuthenticationDetails userDetails = service.GetUserData(token); //*Exception here*
return true;
}
catch (RPXLib.Exceptions.RPXAuthenticationErrorException ex)
{
} return false;
}
I am getting exception at denoted line of code. I am getting token value properly. but could not proceed a head. Exception is :
The remote server returned an error: (500) Internal Server Error.
Stack Trace:
[WebException: The remote server returned an error: (500) Internal Server Error.]
System.Net.HttpWebRequest.GetResponse() +5313085
RPXLib.RPXApiWrapper.Call(String methodName, IDictionary`2 queryData) in D:\Development\Projects (3rd Party)\RpxLib\src\RPXLib\RPXApiWrapper.cs:50
RPXLib.RPXService.GetUserData(String authenticationDetailsIdentifier) in D:\Development\Projects (3rd Party)\RpxLib\src\RPXLib\RPXService.cs:156
SingleSignOn.Controllers.HomeController.signin(String token) in D:\ParallelMinds\Study Material\MVC\SingleSignOn\SingleSignOn\Controllers\HomeController.cs:37
lambda_method(ExecutionScope , ControllerBase , Object[] ) +140
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +52
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314
System.Web.Mvc.Controller.ExecuteCore() +105
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8674318
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
and asks for to open RPXLibWraper.cs from path.
D:\Development\Projects (3rd Party)\RpxLib\src\RPXLib\RPXApiWrapper.cs
what I have to do ?
i acctually had the same issue now and solved it. I am using their helper c# class and the path /api/v2/ is hard coded there. So you cant have that path in th https://rpxnow.come/api/v2/ string also, which is a inparam to the new Rpx() call. So just send in the url without the /api/v2/ to the new Rpx() call. Solved it for me.
Good luck!