Connecting MongoDb.Driver (.Net) with SSL throws value cannot be null error - mongodb

I'm trying to connect a .Net Core API to my SSL protected MongoDB. I can connect using Mongo Compass so I am confident the problem is not in my MongoDB configuration.
Everything was working fine before the certificates were added to the MongoDB and as you'll see the stack points right to the certificates. I just don't know how to correct it.
I wasn't able to find a lot of documentation on how to implement the SslSettings in the MongoDB driver so I'm piecing this together from different sources and SO questions.
The problem seems to come when my API goes to connect to Mongo. I get the following exception.
Value cannot be null. (Parameter 'source')
The stack dump points right to the X509 certificates being the missing / null value.
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Cast[TResult](IEnumerable source)
at MongoDB.Driver.SslSettings.X509CertificateCollectionEqualityComparer.Equals(X509CertificateCollection lhs, X509CertificateCollection rhs)
at MongoDB.Driver.SslSettings.Equals(Object obj)
at System.Object.Equals(Object objA, Object objB)
at MongoDB.Driver.ClusterKey.Equals(Object obj)
at System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)
at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)
at MongoDB.Driver.MongoClient..ctor(String connectionString)
at Bullies.API.Endpoints.Users.UserService..ctor(IOptions`1 config, IMediator mediator) in C:\Users\...\Demo.API\Endpoints\Users\UserService.cs:line 38
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Demo.API.HostedServices.SubscriptionHostedService.<ExecuteAsync>d__2.MoveNext() in C:\Users\...\Demo.API\HostedServices\SubscriptionHostedService.cs:line 32
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Demo.API.Program.Main(String[] args) in C:\...\Demo.API\Program.cs:line 22
appsettings.json connection string
mongodb://user:pass#localmongo:12345/MyDb?authSource=admin&readPreference=primary&appname=demoapi&ssl=true
AccessMongoClass.cs
MongoCredential creds = MongoCredential.CreateMongoCRCredential("localmongo:12345", "user", "pass");
var clientCertificate = new List<X509Certificate>()
{ new X509Certificate("Path\\...\\mysite_com.pfx", "privateKeyPassword") };
MongoClientSettings settingz = new MongoClientSettings();
settingz.ApplicationName = "demo-api";
settingz.Credential = creds;
settingz.SslSettings = new SslSettings()
{
CheckCertificateRevocation = false,
//EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12,
ClientCertificates = clientCertificate,
ClientCertificateSelectionCallback =
(sender, host, certificates, certificate, issuers) => clientCertificate.ToList()[0],
ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true
};
MongoClient client = new MongoClient(settingz);
On the mongodb side I see this error:
"ctx":"conn7","msg":"Interrupted operation as its client disconnected","attr":{"opId":1731}}
The Mongo log is VERY long so I'm just picking out what I think is the key line. If you want to see something else I can easily add it.
I would have thought I provided the X509 certificates but clearly I'm missing something.

I assume you don't see this exception if you just create a new client and in the full stacktrace you see ClusterRegistry.GetOrCreateCluster. This logic is called when the driver is trying to reuse previously created cluster that is stored in a static storage(ClusterRegistry). In your case it looks like you create 2 mongoClients from the settings like this:
var clientSettings1 = new MongoClientSettings()
{
SslSettings = new SslSettings
{
ClientCertificates = new X509Certificate2[] { new X509Certificate2(#"path", "pass") }
}
};
// create client 1
var clientSettings2 = new MongoClientSettings()
{
SslSettings = new SslSettings
{
ClientCertificates = null
}
};
// create client 2
if so, it's a bug in the driver, try avoid setting a null in ClientCertificates for example you can assign an empty collection

Related

Dynatrace.OneAgent.Introspection.MongoDbIntrospection

We have a weird issue, which we think is related to environment setup issue, (we assume both having exactly same setting, as we cant find any different between these 2 machine).
The same piece of code is working in one machine but not other, looking for some advise any hint on how to resolve this. already check this link but no idea is this related to mongodb, as we not combile this. From our project the compile option set to (Any CPU)
Basically this is the basic info about the environment. and solution.
Project, installed
Project 'XXXX.Core' has the following package references
[net6.0]:
Top-level Package Requested Resolved
Microsoft.Extensions.Logging 2.2.0 2.2.0
Newtonsoft.Json 11.0.2 11.0.2
Polly 5.8.0 5.8.0
StackExchange.Redis 2.0.519 2.0.519
StackExchange.Redis.Extensions.Core 4.0.5 4.0.5
StackExchange.Redis.Extensions.Newtonsoft 4.0.5 4.0.5
System.Text.Json 5.0.1 5.0.1
Project 'XXXX.Data' has the following package references
[net6.0]:
Top-level Package Requested Resolved
Microsoft.Extensions.Logging 2.2.0 2.2.0
Microsoft.Extensions.Logging.Abstractions 2.2.0 2.2.0
MongoDB.Driver 2.17.1 2.17.1
MongoDB.Driver.Core 2.17.1 2.17.1
Newtonsoft.Json 12.0.1 12.0.1
System.Data.DataSetExtensions 4.5.0 4.5.0
System.Data.SqlClient 4.6.0 4.6.0
System.Text.Json 5.0.1 5.0.1
Environment
Error
The type initializer for 'Dynatrace.OneAgent.Introspection.MongoDbIntrospection' threw an exception.",
"details": "System.TypeInitializationException: The type initializer for 'Dynatrace.OneAgent.Introspection.MongoDbIntrospection' threw an exception.
---> System.BadImageFormatException: No string associated with token.
The format of the file 'C:\\inetpub\\XXXXXXXXXX..WebApi\\MongoDB.Driver.dll' is invalid.\r\n
at Dynatrace.OneAgent.Introspection.MongoDbIntrospection..cctor()\r\n --- End of inner exception stack trace ---\r\n
at Dynatrace.OneAgent.Introspection.MongoDbAspect.<>c.<OnEnter>b__0_0(ClusterBuilder builder)\r\n
at MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey)\r\n
at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)\r\n
at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)\r\n
at MongoDB.Driver.MongoClient..ctor(MongoUrl url)\r\n
at XXXXXXXXXX..Data.MongoAdapter.MongoAdapter..ctor(String connectionString)
in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..Data\\MongoAdapter\\MongoAdapter.cs:line 19\r\n
at XXXXXXXXXX..WebApi.Startup.<>c__DisplayClass7_0.<ConfigureServices>b__4(IServiceProvider x)
in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..WebApi\\Startup.cs:line 151\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)\r\n
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)\r\n
at XXXXXXXXXX..WebApi.Startup.<>c__DisplayClass7_2.<ConfigureServices>b__15(String key) in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..WebApi\\Startup.cs:line 89\r\n
at XXXXXXXXXX..WebApi.Controllers.ProfileController.Get(String locale) in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..WebApi\\Controllers\\ProfileController.cs:line 83\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\r\n
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)\r\n
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)\r\n
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\r\n
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\r\n
at XXXXXXXXXX..WebApi.Startup.<>c.<<Configure>b__9_0>d.MoveNext() in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..WebApi\\Startup.cs:line 277\r\n--- End of stack trace from previous location ---\r\n
at XXXXXXXXXX..WebApi.Middleware.ExceptionHandlingMiddleware.Invoke(HttpContext context) in F:\\agent9\\_work\\103\\s\\XXXXXXXXXX..WebApi\\Middleware\\ExceptionHandlingMiddleware.cs:line 39"

Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension

I upgraded my web api from .netcore2.1 to 3.1 and updated all nuget packages to their latest version.
Now my api throws the following error
{"StatusCode":500,"ErrorMessage":"Internal server error: Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension'
from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation
Stack: at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer
at MyApi3.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder options) in D:\\a\\1\\s\\MyApi3\\Startup.cs:line 58\
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass1_0`2.<AddDbContext>b__0(IServiceProvider p, DbContextOptionsBuilder b)
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass10_0`1.<AddCoreServices>b__0(IServiceProvider p)
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)\r\n at lambda_method(Closure , IServiceProvider , Object[]
at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.<CreateActivator>b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
-- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)","SystemMessage":"Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension'
from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation."}
I added the following packages and the issue was solved
Microsoft.EntityFrameworkCore.SQLServer (3.1.2)
and Microsoft.EntityFrameworkCore (3.1.2)
Interesting that I got a runtime error not a build error.

Asp.net core TempData give 500 error when adding list and redirect to another view

I am try to build alerts list and added them to TempData. But it work if I did not do redirect. When I do redirect it give me 500 error. I set break point in view as well but it did not hit when did redirect other wise it hit correctly.
ActionMethod
public IActionResult Create(CategoryCreateVM input)
{
if (ModelState.IsValid)
{
var category = mapper.Map<Categories>(input);
categoryBL.Add(category);
List<Alert> alert = new List<Alert>();
alert.Add(new Alert("alert-success", "success message"));
alert.Add(new Alert("alert-danger", "danger message"));
TempData["Alert"] = alert;
return RedirectToAction("Index");
}
return View(input);
}
How I access in view.
#{
var alerts = TempData["Alert"] as List<Alert>;
}
#if (alerts != null && alerts.Count > 0)
{
<div class="">
#foreach (var alert in alerts)
{
<div class="alert #alert.AlertClass alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
#alert.Message
</div>
}
</div>
}
Stack Trace.
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Mvc.ViewFeatures.dll
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Information: Executed action MvcSandbox.Controllers.HomeController.Index (MvcSandbox) in 46.4619ms
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request
System.InvalidOperationException: The 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer' cannot serialize an object of type 'MvcSandbox.Controllers.Alert'.
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer.EnsureObjectCanBeSerialized(Object item) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\TempDataSerializer.cs:line 207
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer.Serialize(IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\TempDataSerializer.cs:line 142
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 62
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.OnResultExecuted(ResultExecutedContext context) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 80
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1023
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1105
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1377
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 493
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 164
--- 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.Builder.RouterMiddleware.<Invoke>d__4.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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() in D:\temp\Session-dev\Session-dev\src\Microsoft.AspNetCore.Session\SessionMiddleware.cs:line 106
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() in D:\temp\Session-dev\Session-dev\src\Microsoft.AspNetCore.Session\SessionMiddleware.cs:line 123
--- 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.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Http.dll
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HL1I8OFS17SU": An unhandled exception was thrown by the application.
System.InvalidOperationException: Session has not been configured for this application or request.
at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Session()
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 57
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.<>c.<OnResultExecuting>b__5_0(Object state) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 57
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<FireOnStarting>d__178.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An exception was thrown attempting to display the error page.
System.ObjectDisposedException: The response has been aborted due to an unhandled application exception. ---> System.InvalidOperationException: Session has not been configured for this application or request.
at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Session()
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 57
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.<>c.<OnResultExecuting>b__5_0(Object state) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 57
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<FireOnStarting>d__178.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.ThrowResponseAbortedException()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<ProduceStartAndFireOnStartingAwaited>d__194.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.Server.Kestrel.Internal.Http.Frame.Write(ArraySegment`1 data)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.Extensions.RazorViews.BaseView.Write(String value)
at Microsoft.AspNetCore.Diagnostics.RazorViews.ErrorPage.<ExecuteAsync>d__6.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.Extensions.RazorViews.BaseView.<ExecuteAsync>d__29.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.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HL1I8OFS17SU": An unhandled exception was thrown by the application.
Finally I figured it out what's the issue after digging into the source code. Asp.Net Core MVC not supported complex data type for TempData currently. It only support string for now. It through this exception while serialize data, if we pass other then string.
The 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer' cannot serialize an object of type 'MvcSandbox.Controllers.Alert'.
I serialize my list to json and then save in TempData.
Here is how I did this. I create extension method to add and retrieve data from TempData.
const string Alerts = "Alerts";
public static List<Alert> GetAlert(this ITempDataDictionary tempData)
{
CreateAlertTempData(tempData);
return DeserializeAlerts(tempData[Alerts] as string);
}
public static void CreateAlertTempData(this ITempDataDictionary tempData)
{
if (!tempData.ContainsKey(Alerts))
{
tempData[Alerts] = "";
}
}
public static void AddAlert(this ITempDataDictionary tempData, Alert alert)
{
if(alert == null)
{
throw new ArgumentNullException(nameof(alert));
}
var deserializeAlertList = tempData.GetAlert();
deserializeAlertList.Add(alert);
tempData[Alerts] = SerializeAlerts(deserializeAlertList);
}
public static string SerializeAlerts(List<Alert> tempData)
{
return JsonConvert.SerializeObject(tempData);
}
public static List<Alert> DeserializeAlerts(string tempData)
{
if(tempData.Length == 0)
{
return new List<Alert>();
}
return JsonConvert.DeserializeObject<List<Alert>>(tempData);
}
Add Alert it TempData
tempData.AddAlert(new Alert(AlertClass, Message));
Finally get 'TempDatainView' and display.
#if (TempData.GetAlert().Count > 0)
{
<div class="alert-container">
#foreach (var alert in TempData.GetAlert())
{
<div class="alert #alert.AlertClass alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
#alert.Message
</div>
}
</div>
}
Did you configure Session? TempData is using session behind the scenes.
Project.json
"Microsoft.AspNetCore.Session": "1.1.0"
Here is the Startup.cs file. - ConfigureServices method
public void ConfigureServices(IServiceCollection services)
{
services.AddSession();
services.AddMvc();
}
And Configure method.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseSession();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Now try with TempData, it will work.
And you can set the environment with set ASPNETCORE_ENVIRONMENT=Development environment variable.
This is what I use to enable Session and Temp data on Core Runtime 2.0.6.
ConfigureServices Section of Startup
// Add MVC service.
services.AddMvc(config =>
{
// Configure global usage of antiforgery tokens.
config.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
})
.AddSessionStateTempDataProvider();
// Adds the ability to use session variables.
services.AddSession(options =>
{
options.Cookie.HttpOnly = true;
});

NullReferenceException with EF6 on Mono 3.0.3

I am trying to migrate existing Entity Framework project to Mono and found a strange bug: when request being executed and EF loads model schema it throws under Mono despite that under .Net with EF6 Alpha 2 it works. An exception is following:
at System.Xml.XmlReader.CalcBufferSize(Stream input)
at System.Xml.XmlTextReaderImpl.InitStreamInput(Uri baseUri, String baseUriStr, Stream stream, Byte[] bytes, Int32 byteCount, Encoding encoding)
at System.Xml.XmlTextReaderImpl..ctor(String url, Stream input, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(Stream input)
at System.Xml.Schema.XmlSchema.Read(Stream stream, ValidationEventHandler validationEventHandler)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.ComputeSchemaSet(SchemaDataModelOption dataModel)
at System.Data.Entity.Core.Common.Utils.Memoizer`2.<Evaluate>c__AnonStorey106.<>m__100()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.GetSchemaSet(SchemaDataModelOption dataModel)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.CreateXmlReaderSettings()
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
at System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.StoreMetadataEntry.LoadStoreCollection(EdmItemCollection edmItemCollection, MetadataArtifactLoader loader)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.StoreItemCollectionLoader.LoadItemCollection(StoreMetadataEntry entry)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadItemCollection[T](IItemCollectionLoader`1 itemCollectionLoader, T entry)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetOrCreateStoreAndMappingItemCollections(String cacheKey, MetadataArtifactLoader loader, EdmItemCollection edmItemCollection, Object& entryToken)
at System.Data.Entity.Core.EntityClient.EntityConnection.LoadStoreItemCollections(MetadataWorkspace workspace, DbConnection storeConnection, DbConnectionOptions connectionOptions, EdmItemCollection edmItemCollection, MetadataArtifactLoader artifactLoader)
at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
at System.Data.Entity.Core.EntityClient.EntityConnection.InitializeMetadata(DbConnection newConnection, DbConnection originalConnection, Boolean closeOriginalConnectionOnFailure)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection()
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<GetEnumerator>m__2C3()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction`1>m__29A[TResult](IEnumerable`1 sequence)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
I guess it cannot load metadata or something like that, at least deapest lines looks like known behaviour of XmlDocument and XmlSchema when they do not check that input stream is null. I tried to use metadata files instead of embedded resources, but it did not help.
I will try to digg into sources, but it would be really helpful if someone already have idea what is going on.
You are running quite unusual configuration, EF compiled by Mono and System.XML from .NET Framework. This itself should work if System.XML can deal with the location of your schema but it's not common configuration.
I'd check how is the schema embedded into your assembly and whether is using same namespace.

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!