用过C#和海康威视VM的来看看这个Bug,困扰很久了

问题遇到的现象和发生背景

用VisionMaster4.1.0进行二次开发,加载方案时弹出如下错误:

img


从其他专业毕业,种种原因转到了机器视觉方向,刚开始学习VM,有不专业的表述请各位见谅。

问题相关代码,请勿粘贴截图

public partial class Form1 : Form
{
bool mSolutionIsLoad = false; //true 代表方案加载成功,false 代表方案关闭

    public Form1()
    {
        InitializeComponent();
    }       

    /****************************************************************************
     * @fn           选择方案路径
     * @fn           Select solution's path
     ****************************************************************************/
    private void buttonChooseSoluPath_Click(object sender, EventArgs e)
    {
        OpenFileDialog openFileDialog = new OpenFileDialog();
        openFileDialog.Filter = "VM Sol File|*.sol*";
        DialogResult openFileRes = openFileDialog.ShowDialog();
        if (DialogResult.OK == openFileRes)
        {
            textBoxSolutionPath.Text = openFileDialog.FileName;
        }
    }

    /****************************************************************************
     * @fn           加载方案
     * @fn           Load solution
     ****************************************************************************/
    private void buttonLoadSolution_Click(object sender, EventArgs e)
    {
        string strMsg = null;
        int nProgress = 0;
        progressBarSaveAndLoad.Value = nProgress;
        labelProgress.Text = nProgress.ToString();
        labelProgress.Refresh();

        try
        {
            VmSolution.Import(textBoxSolutionPath.Text, textBoxPassword.Text);
            mSolutionIsLoad = true;

            IMVSCircleFindModuTool circleFindModule = (IMVSCircleFindModuTool)VmSolution.Instance["流程1.圆查找1"];
            vmRenderControl1.ModuleSource = circleFindModule;
        }
        catch (VmException ex)
        {
            strMsg = "LoadSolution failed. Error Code: " + Convert.ToString(ex.errorCode, 16);
            listBoxMsg.Items.Add(strMsg);
            listBoxMsg.TopIndex = listBoxMsg.Items.Count - 1;
            return;
        }
        
        strMsg = "LoadSolution success";
        listBoxMsg.Items.Add(strMsg);
        listBoxMsg.TopIndex = listBoxMsg.Items.Count - 1;
        
        nProgress = 100;
        labelProgress.Text = nProgress.ToString();
        labelProgress.Refresh();
        progressBarSaveAndLoad.Value = Convert.ToInt32(nProgress);
    }

下面是app.config的代码,百度了很多解决方法都是app.config里的名称有问题,但这个问题我没找出来。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--启动服务形式(0代表默认系统服务, 1代表exe方式启动)-->
    <add key="StartServerByExe" value="0"/>
    <!--服务绝对路径,用于拉起服务(value为""时默认拉起系统服务,value为服务路径时为以进程方式启动)-->
    <add key="ServerPath" value=""/>
    <!--<add key="ServerPath" value="E:\Program Files\VisionMaster\VisionMaster4.1.0\Applications\Server\VisionMasterServer.exe"/>-->
    <add key="ClientSettingsProvider.ServiceUri" value=""/>
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="myLibs;myLibs\Newtonsoft.Json;3rdLib;3rdLib\System;3rdLib\MsgPack;3rdLib\Log4Net;3rdLib\ICSharpCode;3rdLib\OpenCv;GateWay;Module(sp)\x64;Module(sp)\x64\Collection\ImageSourceModule;Module(sp)\x64\Location\IMVSCircleFindModu"/>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
      </providers>
    </roleManager>
  </system.web>
</configuration>

运行结果及报错内容

img

Form窗口可以运行,选择方案路径也可以选择,但到了加载方案时就报错

我的解答思路和尝试过的方法

检查了很多次引用的dll和配置环境,都没找到问题

我想要达到的结果

大手子们帮忙看看,谢谢!