I have a project under source control and I'm using a dynamic view. This project uses sockets. When I run the program I get an exception using this line of code:
var addresses = Dns.GetHostAddresses(Dns.GetHostName());
I get a socket exception with the following information:
Error Code: 11003
Message: "A non-recoverable error occurred during a database lookup"
Socket Error Code: NonRecovery
I don't have this issue running locally or on another windows network share (non-Clearcase). I believe this is a security issue related to sockets and network drives. I have a workaround but would really like to resolve this issue. I'm on Windows 7.
The first workaround would be to use a snapshot view instead of a dynamic one.
That way, you would be directly on the C drive instead of an MVFS mount point.
If you have to use dynamic view, make sure it is being accessed through its full path (no subst, no setview): M:\myview\myVob\...
Finally, it can depend on your exact ClearCase version: with ClearCase 7.x, there was socket error on Windows before: see "Unable to run executable that opens a socket on Microsoft Windows Vista, Windows Server 2008 or Windows 7"
Related
I'm willing to let the user to create a dummy Wlan network profile through my windows 10 application and edit it afterwards using windows UI.
I've managed to do so using NativeWifi WlanSetProfile function with one of those profile Xml samples, but, when I'm opening the windows edit profile UI using the WlanUIEditProfile function, I can change the security type drop down (from WPA2-Personal to WPA2-Enterprise for example) but when I'm trying to save it (press OK) I'm receiving the following message:
"Windows has encountered an error saving the wireless profile.
Specific error: The network connection profile is corrupted."
I'm able to change and save all the other properties besides the security type.
I'll be glad if someone can help me resolve this issue.
I also met this problem.
Now I fix it like this:
In my profile
old settings:
WPA2PSK
AES
and changed to new setings:
WPAPSK
TKIP.
My Win10 version: 1607(OS build 14393.0).
I'm trying to write a simple program that would connect to remote machines and query the indexing status.
Here's the code that does it on my machine. This works OK.
using System;
using Microsoft.Search.Interop;
namespace IndexStatus
{
class Program
{
static void Main(string[] args)
{
CSearchManager manager = new CSearchManager();
CSearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex");
_CatalogPausedReason pReason;
_CatalogStatus pStatus;
Console.WriteLine(catalogManager.NumberOfItems().ToString());
int plIncrementalCount;
int plNotificationQueue;
int plHighPriorityQueue;
catalogManager.NumberOfItemsToIndex(out plIncrementalCount, out plNotificationQueue, out plHighPriorityQueue);
Console.WriteLine(plIncrementalCount.ToString());
Console.WriteLine(plNotificationQueue.ToString());
Console.WriteLine(plHighPriorityQueue.ToString());
catalogManager.GetCatalogStatus(out pStatus, out pReason);
Console.WriteLine(pStatus.ToString() + " " + pReason.ToString());
Console.ReadLine();
}
}
}
However, when I call GetCatalog on "mycomputername.SystemIndex" instead of "SystemIndex", I get
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in
IndexStatus.exe
Additional information: Exception from HRESULT: 0x80042103
Visual Studio 2015 is running with admin permissions on Windows 8.1. The target computers will be Windows 7 systems mostly and the program will mostly be run from a Windows 10 system. I'm using Microsoft.Search.Interop.dll from Microsoft Windows Search 3.X SDK downloaded from here. I turned the firewall off in case that had anything to do with it, but apparently not.
I've checked that I get the same exception if I call the function on complete nonsense like "sdfd". And I've found this:
MSS_E_CATALOGNOTFOUND - 0x80042103 - (8451) WindowsSearchErrors.h
The specified catalog was not found. Check to see if it was deleted, or if there are errors in your application code.
I've tried to use "localhost" instead of the machine name, but that didn't help.
The MSDN docs say this:
Currently Microsoft Windows Desktop Search (WDS) 3.0 supports only one
catalog and it is named SystemIndex.
I'm not sure how to understand this. Perhaps the method is not able to choose between different machines? If so, is there a way to connect to a remote catalog and make these queries, other than using something like PsExec?
Re Ben N's answer: This is starting to become deep water for me, but I'm more fascinated than afraid. :) Your code worked for me after several modifications:
CSearchManagerClass manager = System.Runtime.InteropServices.Marshal.CreateWrapperOfType(comManager, typeof(CSearchManagerClass));would not compile on Visual Studio 2015 and would give the following errors:
The second error was easy to fix by just adding a cast:
CSearchManagerClass manager = (CSearchManagerClass)System.Runtime.InteropServices.Marshal.CreateWrapperOfType(comManager, typeof(CSearchManagerClass));
As for the "Interop type cannot be embedded" error message, I found this question. There are two suggested solutions:
Change the Embed Interop Types property of the Microsoft.Search.Interop reference to False.
Change CSearchManagerClass to CSearchManager.
The first solution makes the program compile, but it affects portability. Now the program won't run on a computer that doesn't have the .dll on it. The second solution compiles but throws
An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: The type must be __ComObject or be derived
from __ComObject.
on that exact line when I run it against my own machine.
But there is another problem, and this one I have no clue about. When I run it against my colleague's machine (I'm an administrator on his computer and Visual Studio is running with admin permissions), I'm getting
An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for remote
component with CLSID {7D096C5F-AC08-4F1F-BEB7-5C22C517CE39} from
machine computername failed due to the following error: 80070005
computername.
This does scare me a little bit because I know next to nothing about COM. I've checked that DCOM is enabled on his computer and on mine. But when I try to go to his computer in Component Services it shows as a and DCOM Config is missing from the tree. And the same happens for other computers on the domain (even though I have admin rights on all workstations). This blog suggests it could be a firewall issue and if it is, it's not something that will be feasible to overcome.
Both of your answers are definitely bounty worthy already, but if you have any suggestions or would be able to shed some light on what's happening, I would be very grateful. If I can't make it work, it's fine, but I would definitely like to take as much knowledge as possible from this.
GetCatalog doesn't support reaching out to a remote machine, but we can use COM to create a search manager object that refers to the service on the target computer.
// Assume targetMachine has the name of the target computer
Guid guid = new Guid("{7D096C5F-AC08-4F1F-BEB7-5C22C517CE39}");
Type managerType = Type.GetTypeFromCLSID(guid, targetMachine, true);
var comManager = Activator.CreateInstance(managerType);
CSearchManagerClass manager = (CSearchManagerClass)System.Runtime.InteropServices.Marshal.CreateWrapperOfType(comManager, typeof(CSearchManagerClass));
You should then the able to use manager as though it were the manager of the local machine. If there's a problem contacting the remote computer, a COMException will be thrown on the CreateInstance call.
For the PowerShell version of this, see my answer to your Super User question.
I have an application that takes screenshots from the local computer.
This works since many years correctly until suddenly a colleague reported me that he got an "The handle is invalid" error from my application.
This error came from inside the .NET framework from Graphics.CopyFromScreen().
To work around this I replaced this function with C++ code using GetDC(GetDesktopWindow()) / GetDC(NULL) and BitBlt() to copy the screen into a bitmap. Now I got ERROR_INVALID_HANDLE.
This happens on Windows 7.
What is going on there ?
I can not investigate this problem on my own because I cannot reproduce it and my colleague is in another country.
I searched in Google and lots of people report this error.
But all posts that I found were from people who tried to take a screenshot from a client computer through ASP code on a server. I don't understand how people can have the strange desire to capture the client's computer from a website. It is obvious that this will not work.
But I could not find one single case where someone reports this problem from an application that cannot capture the screen of the SAME computer in the SAME session where the application itself is running.
After investigating more with my colleague and giving him ideas what he can try, he told me that he starts my application through a remote desktop session.
The remote desktop session creates a virtual desktop (you see for example that the desktop wallpaper is missing).
I told my colleague to install a VNC client to remote control the computer instead of a remote desktop session and now all works fine. He installed TightVNC which uses the REAL desktop user session instead of creating a virtual session and locking the screen of the machine.
So if anyone gets reports of "The handle is invalid" while taking a screen capture, ask your users if they use a remote desktop session.
To detect a remote desktop session in code you can write:
in C++:
if (GetSystemMetrics(SM_REMOTESESSION) > 0)
{
MessageBox(m_hWnd, L"This application may not work correctly in a remote desktop session", "Error", MB_ICONSTOP);
}
or in C#:
if (System.Windows.Forms.SystemInformation.TerminalServerSession)
{
Messagebox.Show("This application may not work correctly in a remote desktop session");
}
Note that the problem is not reproducible on all computers. When I test on my own Windows 7 it works. So there are probably any additional system settings or other factors that trigger the "The handle is invalid" error (service packs / hotfixes...?).
But my colleague reports that he has never seen the error again after he stopped using the remote desktop connection.
There are a few reasons this can happen but the underlying theme is that the desktop window isn't available when this method is called.
In addition to the reasons mentioned above, another reason this can happen is if this method is being called when the screen is locked.
The code for CopyFromScreen has this section:
int result = SafeNativeMethods.BitBlt(targetDC, destinationX, destinationY, destWidth, destHeight, screenDC, sourceX, sourceY, (int) copyPixelOperation);
//a zero result indicates a win32 exception has been thrown
if (result == 0) {
throw new Win32Exception();
}
It would seem to me that the safest course of action would be that if you make use of this function, make sure that you also write your code assuming that receiving a Win32Exception or an unavailable Desktop Window is a use case which must be handle so the application doesn't crash.
I am trying to create a simple Windows Phone 8.1 (hence Windows.Networking.Sockets) socket client, and Windows 8 server. Unfortunately I am quite new to this task, so I am having problems understanding the obstacles that appear.
I am using http://msdn.microsoft.com/pl-pl/library/fx6588te(v=vs.110).aspx this code as a server. However when it comes to the Windows Phone 8.1, it turned out that http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202858(v=vs.105).aspx this tutorial won't work, as there is no way to use the following import:
using System.Net.Sockets.
Which is the reason why i switched to the following code:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj150599.aspx (which is btw quite sloppy, and full of errors)
So I embedded the Windows Phone 8.1 part of the code into my application, and it seems to connect correctly to the server, and it even sends data to the server, however the app crashes right after the following statement.
"Trying to send data"
And the output is exactly like the following:
A first chance exception of type 'System.ArgumentException' occured in Project.exe
WinRT information: count
Please help me solve the error, as I have vainly spent many hours trying to fix this..
EDIT
Here is the part of code from the mentioned tutorial, that throws the described error
// Now try to receive data from server
try
{
OutputView.Text = "";
StatusText.Text = "Trying to receive data ...";
DataReader reader = new DataReader(clientSocket.InputStream);
// Set inputstream options so that we don't have to know the data size
reader.InputStreamOptions = Partial;
await reader.LoadAsync(reader.UnconsumedBufferLength);
}
I have been struggling with this since 1 month. Can someone please help me with this scenario?
I have QTP installed on one server and my ASP.Net web application installed on a different server. I am trying to invoke QTP from my web server using C# or VBS code. Both approaches are not working. After doing a lots of research i came to know that i will need to add the user that is trying to invoke QTP to COM settings on QTP server. I even added my self to the COM settings but this approach is not working as well. After doing some research i came to know there might be a problem with permissions or firewall restrictions. But i have reached out to our network team and came to know that there are no firewall restrictions between our servers. Below are the C# and VBS approaches i used and there outcomes. Please help me with this request if anyone knows the solution for this issue. Thanks in advance.
VBS approach:
.cs file code
System.Diagnostics.Process.Start(#"C:\Program Filestest1.vbs");
.vbs file code
Dim qtApp
Dim qtTest
Dim qtResultsOpt
Set qtApp = CreateObject("QuickTest.Application","Server IP")
qtApp.Launch
qtApp.Visible = True
Outcome:
Code ran On Server : No error message and it dint invoke QTP on the other server.
Code ran from local : Error message Permission denied: 'CreateObject' , 800A0046.
C# code approach:
Type remoteQTP = Type.GetTypeFromProgID("QuickTest.Application", "Server IP");
QuickTest.Application qtp = (QuickTest.Application)Activator.CreateInstance(remoteQTP);
qtp.Launch();
qtp.Visible = true;
Outcome:
Retrieving the COM class factory for remote component with CLSID {2B9B8E92-EBAA-44AF-A23C-9FBD08EAFA54} from machine Server IP address failed due to the following error: 80070005.
Can you check whether you have permissions specific to the QTP Remote Agent COM service on your target machine. Here are the steps:
Go to Control Panel>Administrative Tools>Component Services.
In the Component Services snap-in, navigate to Computers\My
Computer\DCOM Config.
In the right pane, locate AQTRmtAgent.
Right- click the AQTRmtAgent and then select Properties.
On the Security tab, select Customize, and then click Edit.
Add the user to the permissions list.
PS: Sorry I just re-read your question and you mention you have tried adding the user to COM settings but it does not specify which process you tried to add, So I'll keep my post and try to help based on your response.