所谓的潇洒

导航

2020年11月21日 #

未能加载文件或程序集“xxx”或它的某一个依赖项。试图加载格式不正确的程序。

摘要: 刚部署到IIS的网站,访问时报错:未能加载文件或程序集“xxx”或它的某一个依赖项。试图加载格式不正确的程序。 原因:VS编译时用的x86,而程序池默认是按照64位启动的 解决步骤: 点击网站使用的程序池 点击右上角的“设置应用程序池默认设置” 将常规项中的“启用32位应用程序”改为true,保存 阅读全文

posted @ 2020-11-21 17:05 所谓的潇洒 阅读(566) 评论(0) 推荐(0) 编辑

2020年11月11日 #

IniHelper

摘要: using System.IO; using System.Runtime.InteropServices; using System.Text; namespace MyProject { public class IniHelper { private string iniPath = stri 阅读全文

posted @ 2020-11-11 16:36 所谓的潇洒 阅读(146) 评论(0) 推荐(0) 编辑

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.

摘要: 原因之一:主程序和调用的组件都引用了Newtonsoft.Json.dll,且版本不一样 解决:调用的组件若是公共组件,可以考虑将用到Newtonsoft.Json的方法封装到公共组件;如果不是公共组件就引用同一个地方的dll 阅读全文

posted @ 2020-11-11 15:55 所谓的潇洒 阅读(883) 评论(0) 推荐(0) 编辑

2020年10月16日 #

The type of namespace name "Bll" does not exist in the namespace "MyProject"

摘要: 引用自己项目的组件报错: The type of namespace name "Bll" does not exist in the namespace "MyProject" 原因之一: 引用者的.net framework版本低于被引用者 阅读全文

posted @ 2020-10-16 10:38 所谓的潇洒 阅读(243) 评论(0) 推荐(0) 编辑

2020年9月18日 #

表单提交PostFormHelper

摘要: Web后台或Winform程序与其他系统对接时,经常用到HTTP/HTTPS的接口调用,且多为Post,我从网上搜到了相关代码,并在使用过程中补充了三个参数,PostFormHelper.cs如下 using System; using System.Collections.Generic; usi 阅读全文

posted @ 2020-09-18 09:57 所谓的潇洒 阅读(345) 评论(0) 推荐(0) 编辑

2020年9月17日 #

带复选框的TreeView

摘要: 项目中多处用到TreeView,每一个树都要全选、取消全选、层级联动、屏蔽双击复选框,于是很有必要封装一个CheckTreeView,步骤如下: 在项目中右键->添加->新建项,选择Windows Forms下的用户控件,名称改为CheckTreeView.cs 拖入一个TreeView,Check 阅读全文

posted @ 2020-09-17 17:24 所谓的潇洒 阅读(572) 评论(0) 推荐(0) 编辑

2020年8月31日 #

多个控件共用右键菜单

摘要: 多个控件共用右键菜单,可以实现菜单事件代码共用,那么问题来了,当事件触发后怎么知道是哪个控件触发的呢? 方法: private void menu_Rename_Click(object sender, EventArgs e) { try { var pBox = (PictureBox)((Co 阅读全文

posted @ 2020-08-31 14:16 所谓的潇洒 阅读(284) 评论(0) 推荐(0) 编辑

反射语法

摘要: 假设有如下类,及其对象a: public class A { public string Name { get; set; } } 获取属性值语法: Type type = a.GetType(); var property = type.GetProperty("Name"); string va 阅读全文

posted @ 2020-08-31 12:01 所谓的潇洒 阅读(121) 评论(0) 推荐(0) 编辑

FTP连接数不够用

摘要: 当短时间内有很多(1K-2W)文件需要上传FTP时,异常日志如下: System.Net.WebException: The remote server returned an error: 227 Entering Passive Mode >System.Net.Sockets.SocketEx 阅读全文

posted @ 2020-08-31 11:23 所谓的潇洒 阅读(1812) 评论(0) 推荐(0) 编辑

2020年8月19日 #

判断sql对象是否存在,不存在就创建

摘要: --创建主键IF NOT EXISTS (select name from dbo.sysobjects where xtype='PK' and parent_obj=(select id from dbo.sysobjects where name='Employee'))BEGIN ALTER 阅读全文

posted @ 2020-08-19 19:14 所谓的潇洒 阅读(969) 评论(0) 推荐(0) 编辑