My application has an HTTP channel to run a method on a remote computer. I'm able to do that with one computer by using the line:
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(
typeof(RemoteObject), uri);
I also need to run another method on another computer. So I used the same line as above but changed the URI to the name of the other remote computer. However, I am getting this RemotingException:
Attempt to redirect activation of type 'RemoteClass.RemoteObject, RemoteObject'
which is already redirected.
I've done some research on this exception but haven't found too much information about it. I've looked at the documentation for the exception, but don't really understand it. I tried to find the cause of the error, and learned that if I change the parameter typeof(RemoteObject) such that typeof() is applied to an object of a different type, it works fine. But I still need to use RemoteObject as the type in order to run a method from that class. Is there a work around for this?
Related
I just started to use MongoDB(4.4) and its C# driver. I set up my MongoDB with the default option, localhost:27017. Then I turned on the authorization, created a superuser with root permission, like this:
db.createUser(
{
user: "superuser",
pwd: "123",
roles: [ "root" ]
}
)
I tested it on both Mongo shell and Compass, it all worked as expected, connected with correct password, and denied with the wrong one.
Then I created a C# windows form app, use NuGet to install all required packages such as MongoDB.Driver for C#(v2.11.0) and its related packages such as MongoDB.Bson, etc
After that, I used the following code to create a MongoClient:
MongoClient client = new MongoClient( "mongodb://superuser:12#localhost:27017" );
So I expected it should throw an exception because I used the wrong password, "12" in this case. But it didn't. Then I tried to list database names with:
client.ListDatabaseNames();
It threw a timeout exception: "A timeout occured after 30000ms selecting a server using CompositeServerSelector"
Even I used the correct password or turned off the authorization, and just go with "mongodb://localhost:27017" or ""mongodb://127.0.0.1:27017", it still threw the same timeout exception.
It feels like something wrong with that client it created which caused the timeout issue later on. But I couldn't figure out what I am missing.
Thank you for your help!
Edit:
The same code works perfectly in a console app, just not a windows form app, which really confuses me.
After trial and error for 2 days, I finally found a work around for this issue, still don't know why this works though.
So basically I have to split the MongoClient creation and its following function calls separately. I can't do anything related to the MongoClient right after its creation. For example, the following throws the time out exception:
MongoClient client = new MongoClient( "mongodb://localhost:27017" ); //I turned off authorization
client.ListDatabaseNames(); //Throw time out exception here!!!
I have to split them separately in 2 functions call, like one in a "Connect" button event, another one in a "ListDatabaseNames" button event.
Once I did that, everything works fine.
mongodb://superuser:12#localhost:27017?authMechanism=SCRAM-SHA-1
because dotNet not support SCRAM-SHA-256 yet
Creating a client does not perform any network operations like connecting to your MongoDB deployment - that is done in background. Hence incorrect credentials won't make client creation fail.
mongo shell works differently and compass probably performs some queries that would fail if credentials aren't correct.
Why you are getting a timeout error - my guess is it's an ipv4/ipv6 difference. Try 127.0.0.1 instead of localhost. If this doesn't help enable debug information in your driver.
I am assuming it has something to do with my app pool/IIS but why is this error only being thrown while in Production?
To Start- I have read every related question about this topic on SO.
I cannot reproduce this error in my Dev and/or Test environments. I have sent hundreds of POST requests using postman(DEV), I have also used my iOS application pointing to my Test Environment and sent thousands of requests and I am still in the same boat.
About my Project: I am using WebAPI and my application is running on iOS10 written in swift. I only receive this error occasionally and cannot reproduce it on command. I am wondering if anyone else has run into this issue and if so, what were the steps you took to take care of this problem?
Error #1
The source was not found, but some or all event logs could not be searched.
To create the source, you need permission to read all event logs to make
sure that the new source name is unique. Inaccessible logs: Security.
Note: This error is not causing me to lose any data when I receive it, all records are still being committed to my database. So it is not a huge issue since I only get the error 1 out of about 100 times a new record is submitted. But curiosity is killing me and wanted to see if anyone had any suggestions.
I've been trying possible solutions that I can find online with the bottom error message with no luck.
An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code
Additional information: The HTTP request to the remote WebDriver server for URL http://localhost:49357/session/8490ba8026d4a3d1bb60f08d2063ae79/elements timed out after 60 seconds.
protected bool Exists(By by)
{
return wd.FindElements(#by).Any();
}
When I run any of my scripts that come across the "Exists" method (posted above) where I'm expecting the element it's searching for to NOT BE there, I get the error message "The HTTP request...timed out after 60 seconds.". However, this only happens when I run the test in Chrome and the element doesn't exist on the page (when it does exist, it has no issues with the Exists method). When I run the script with Firefox, it has no issues at all.
I've tried extending my commandTimeout to twice the time, but it still fails at 60 seconds. Tried changing the "webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(###))" to twice it's wait length, no success. Looked through everything in my code base that has a timeout method and tried to change those, no success there either. I even went as far as change the ChromeOptions BinaryLocation to be pointed at the actual chromedriver.exe file.
If anyone can suggest on how to find the default location of the correct wait command or how to solve my issue with how to identify when an element isn't present on the screen, that would help immensely.
I've recently migrated my environment and now a process that uses BulkInsert is not working. It is resulting in a 403 Forbidden response from the db server.
The previous environment had the database running as a Windows service on the same server as my application and access was set up differently. Now I'm using RavenHQ on a remote host, using an API Key. I'm sure the privileges have changed so I'm wondering if that's why BulkInsert is resulting in 403 error.
I've searched but I cannot find anything that explicitly states what privileges are required for the various raven operations. My understanding from this post is that there are at least some that require higher privileges. Can anybody point me to documentation on specifics? Or otherwise shine some light on the subject? Thanks.
I had this same problem and I think it's because the example connection string RavenHQ gives you containing your API key does not actually include your database name.
Try adding ";Database=[myDb]" to the end of your connection string URL or passing your database name explicitly as the first parameter to bulkInsert()
I am using the Mathematica .Net/Link platform to create a web service to format and calculate math problems. However I am unable to get it working.
I create it using this code:
_Log.IpDebug("Starting the Kernel Link");
if (string.IsNullOrEmpty(_MathLinkArguments))
_InternelKernel = MathLinkFactory.CreateKernelLink();
else
_InternelKernel = MathLinkFactory.CreateKernelLink(_MathLinkArguments);
_Log.IpDebug("Kernel Link Started");
_InternelKernel.WaitAndDiscardAnswer();
The value of _MathLinkArguments is -linkmode launch -linkname \"C:\\Program Files\\Wolfram Research\\Mathematica\\7.0\\Math.exe\".
This piece of code is called from the Application_Start method of the global.asax.cs file.
When it gets to the WaitAndDiscardAnswer() call it gives the server error:
Error code: 11. Connected MathLink program has closed the link, but there might still be data underway.
Note: The SampleCode given with the .NET/Link package (both a console app and a WinForms app) works.
Edit:
I copied the console app sample code given with Mathematica into an asp.net page and it gave me the same error the first load and then on subsequent loads it gave me:
Error code: 1. MathLink connection was lost.
Edit2:
I forgot to mention that when I have procmon and task manager open while running my app, I can tell that Math.exe starts but it immediately exits, which makes those error code make complete sense...but doesn't explain why that happened.
To allow the .Net/Link to work in Asp.net (at least in IIS 7.5) you need to enable the property loadUserProfile on the app pool for the web site.
I am not entirely sure why this is the case, but from what I found while trying to debug this, there are some things that are gotten from the user's profile. I know for a fact that the default location of the kernel is, which explains why I couldn't use it with no arguments, and so I can only assume that other things are needed as well and without the profile it couldn't determine that.
But whatever the reason is this is required, it is, or at least it is a fix if you are getting similar problems like this in your own application.
I got the same error in a .Net WinForm application.
mathKernel = new MathKernel();
mathKernel.Compute("<< XYZ`XYZGraphs`");
The error occurred on loading the package straight after instantiating the MathKernel.
To resolve it you can wait a couple of seconds and then instantiating the MathKernel works fine. During this state where there might still be data underway the following conditions are both false:
if (!MathKernel.IsConnected)
{
MathKernel.Connect();
}
if (MathKernel.IsComputing)
{
MathKernel.Abort();
}
Edit:
I've recieved the error again and this time was able to determine the problem.
Using a command line open the MathKernel.exe and view the error message: