Tag Archives: c#

C ා imitate on error resume next in VB

C# mimics VB’s On Error Resume next
and adds a try catch. The exception is not handled in catch
Try
{
the for (int I = 0; i < 10; I++)
{
try
{
int p = 0;
int d = I/p;// is zero, will go wrong

} catch

attach MessageBox. Show (i.T oString ());// here say, will cycle through ten times

}}
the catch (Exception ex)
{
MessageBox. Show (ex. Message); // because the error divided by zero is caught by the inner try catch, the outer try catch will not catch the error divided by zero
}

C ා use math.net Read. Mat file, file content is complex

0. The project needs to read the complex file (.mat) generated by matlab simulation through C#, and then process it. The contents of the file are shown in the figure below:

1. Add DLL file: find Mathnet by NuGet manager, search mathnet.Numerics as shown in the figure below, install Mathnet.numerics;

2. Add references:

3. The following method can be used to read complex data.

HALCON error #2036: could not find license file in operator set_ Part solution

HALCON error #2036: could not find license file in operator set_part
operator set_part
copy the license folder into the root directory of exe, then you can run the program normally



2019-03-04
change the license_xxx.dat to license.dat and put it in the root directory of the running program to solve the license_xxx.dat. Please note that the license_xxx.dat must be valid and have no expired certificates

Solution to the error code of 0x80040154 in COM / ole call

1. The background
In the project development, in order to make C# call the original C++ developed OLE interface program, the following method was adopted to establish C++CLI project as an intermediate DLL, with the following advantages:
(1) on the one hand, he can better use C++ to access OLE API functions, and the original C++ development of OLE programs better combination;
(2) on the other hand, C# can easily reference C++CLI DLL, so that the implementation of C# code on the old version of OLE program calls quickly;
(3) low coupling, easy to test, about the correctness of OLE interface and C++CLI, you can independently set up a test project to test.

Therefore, C# projects utilize the invocation relationship of C++ OLE as follows:
C # = = & gt; > > C + + the CLR = = & gt; > > C + +, OLE

Problem 2.
In the real project, the OLE program is developed by another TEAM, we just call it. But during the testing process, the call to OLE interface in the latest test environment failed. Debug finds that the C++CLI failed to initialize the specified OLE program when calling the OLE interface with the error code 0x80040154, which means the following:

OLE error code 0x80040154. Class is not registered.

The main online solution is to call the RegSVR32 command to register your program. The purpose of registration is to establish the mapping relationship between ProgramID and CLSID in the registry. In my understanding, ProgramID is equivalent to our name. When we use the API to call the COM/OLE interface, we pass a plain string called ProgramID, and the API internally operates on the CLSID based on the mapping stored in the registry. There is a subkey in the registry with CLSID as key and its name is LocalService32. The corresponding key value of this key stores the local full path of the final OLE program. Finally, it is found that this key value in our test environment is wrong and does not point to the real OLE program path, thus causing failure in the initialization of OLE program. Given the wrong program path, the loader must fail.

3. Solutions

Modify the CLSID stored in the OLE program full path.

Mongodb encountered an error: connect econnreused 127.0.0.1:27017

Node with MongoDB is configured to appear when access is completed
Error: reach econnunion 127.0.0.0.1 :27017, return Error
The reason is that your MongoDB database is not open,
The solution under Node can be turned on by Mongod
 
Here are the links I found:
https://cnodejs.org/topic/5646b746c5dcc06702210adf
https://stackoverflow.com/questions/36400233/connect-econnrefused-127-0-0-127017

Reproduced in: https://www.cnblogs.com/herewego/p/9278904.html

IIS 7.5, ASP.NET MVC. HTTP error 500 (internal server error), but debugging does not enter the background, the browser only reports 500 errors

Bugs, such as:
IIS 7.5, ASP.NET MVC. HTTP Error 500 (Internal Server Error) uploadify uploads images, the browser only reported 500 errors, the progress bar does not move, but debugging does not enter the background
After several days of searching, I could not debug the source of the error. I also wondered whether the maximum byte limit of the upload was limited. However, I finally found the prompt of foreign gods under Google and determined that it was this error.
http://stackoverflow.com/questions/17188930/iis-7-5-asp-net-mvc-http-error-500-internal-server-error-an-unexpected-cond
Solutions:
& lt; The httpRuntime requestValidationMode = “2.0” maxRequestLength = “100000”/& gt; The configuration file adds a maximum byte limit

Error 1606 Could Not Access Network Location %SystemDrive%/inetpub/wwwroot/

Prompt for title error when uninstalling or reinstalling Infragistics NetAdvantage
Under Windows 7
1. Open registry Regedit
2, find the HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/InetStp PathWWWRoot
64-bit operating system: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InetStp\PathWWWRoot
% SystemDrive %/inetpub/below/= = “C: \ inetpub \ below

 

 

Visual SVN server provider failed to perform the attempted operation 0x80041024 after win7 upgraded win10

After win7 upgraded win10, the VisualSVN Server provider was unable to perform the attempted operation 0x80041024

VisualSVN Server.msc can be found under the bin folder of the installation directory to add shortcuts. VisualSVN is recommended to install to disk C.

Error when opening VisualSVN Server: the provider was unable to perform the attempted operation (0x80041024), as shown below

Fix it by “fixing” the source file:
1. Find the installation source of VisualSVN, double-click, and select Repair (Repair) to complete the Repair.
In fact, VisualSVN official website also provides the cause of the problem analysis and repair methods
It mainly includes:
1. TCP/IP port is occupied;

2. Conflict with third-party anti-virus software or firewall;
3. The parent folder of the VisualSVN installation folder cannot be accessed (it is recommended to install to disk C).
4. The root folder of the version library cannot be accessed;
Through the Windows event viewer, the log information of the VisualSVN Server can be viewed to determine the cause of the failure:

Arithmetical overflow error converting expression to data type datetime

After changing the Sql Server database language, our ContentServer cannot edit the newly created file when using DA. The exception arithmetic overflow error converting to data type datetime cannot be solved by changing the database language again. Today, I found that the ODBC connection configuration has also been changed. So replace it back

If any of the above occurs, see if the language is consistent with the database language.

Reproduced in: https://www.cnblogs.com/yangqianming/archive/2011/07/15/2107445.html

TCP error code 10061: unable to connect because the target machine actively refused http://localhost :8732/Design_ Time_ Addresses/TeacherHelperServic

 
An error occurred when we added a WCF service reference to the client with the following message:
TCP Error code 10061: Unable to connect due to active rejection of target machine
http://localhost:8732/Design_Time_Addresses/TeacherHelperServic
Unable to connect to remote server due to active rejection of target machine. 127.0.0.1:8732 /

Possible reasons:
1. The corresponding service port is not opened
2. Some TCP listening services are not enabled
3. The Client does not match the Serivce configuration
Solution reference:
 
1. Check firewall Settings. Do you open the service port, such as 8732?If not, add the service port as a secure port.
2. Check whether the service hosting process is started. In this case, the service hosting program is usually run for a custom host to host the service.
3. Perhaps a service such as net.TCP Listener Adapter is not started. The Net.TCP Listener Adapter is set to start automatically.