获得徽章 0
idea配置Java项目
1. 确保选择了正确的JAVA SDK和语言版本,现在的ide竟然还默认1.5版本的java
2. 发现项目中用了阿里的这个镜像,总是出现一些构件有问题。阿果呀阿果。。。
<repositories>
<repository>
<id>spring</id>
<url>maven.aliyun.com</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
3. 遇到构件无法读取时,可以把构件删除,然后重新构建
展开
1
再次遇到.net project运行时错误:未能加载文件或程序集“ICSharpCode.SharpZipLib”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。
本质原因是什么呢?为什么.net项目中经常出现这个问题?在java项目中确很少有类似的运行时错误?


解决办法:将Web.config中的程序集重定向配置注释掉
<!--<dependentAssembly>
 <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-1.0.6053.22017" newVersion="1.0.6053.22017" />
</dependentAssembly>-->
展开
评论
# 安装redisbrew info redis
brew install redis
# 将redis/bin加入环境变量
vim ~/.zprofile

REDIS_HOME=/usr/local/opt/redis
PATH=${PATH}:${JAVA_HOME}/bin:${M2_HOME}/bin:$REDIS_HOME/bin
export PATH

# 使用redis-cli
redis-cli -h 127.0.0.1 -p 6379
-- 连接后输入auth命令进行认证
auth
-- 使用select 0切换成0号数据库
select 0
-- 使用scan命令搜索keys
scan 0 match *Test_Key* count 100
展开
评论
多年不写C#代码了,好多新语法值得学习。
C#7的9个新语法
www.cnblogs.com
评论
运行.net4.8测试用例失败
Could not load type 'Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior' from assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework
解决办法:升级相关的nuget依赖
从2.0.1升级到3.0.2
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="3.0.2" targetFramework="net48" />
<package id="MSTest.TestFramework" version="3.0.2" targetFramework="net48" />
</packages>
展开
评论
体验dotnet构件生成过程
查看nuget spec/pack/push命令帮助
D:\work> .nuget\NuGet.exe push -Help

常用命令
nuget spec -- 生成构建配置
nuget pack .\package.nuspec -OutpushDirectory .\bin
nuget setApiKey xxx -Source api.nuget.org


nuget pack .\package.nuspec
nuget push .\bin\YYY.Redis.Client.Net48.0.0.2.999.nupkg -Source api.nuget.org
展开
评论
MacOS下彻底删除卸载jdk
# 删除JavaAppletPlugin.PreferencesPanes。Application Support
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java

# 删除文件
cd /Library/Java/JavaVirtualMachines
sudo rm -rf /Library/Java/JavaVirtualMachines/{这个地方是自己的jdk版本}

blog.csdn.net
展开
评论
#在IIS7.0以上配置网站初始化

# 查看服务器是否已安装组件
appcmd list config /section:globalModules | findstr warmup.dll
# 如果没有安全使用下面的命令来安装IIS-ApplicationInit
dism /online /enable-feature /featurename:IIS-ApplicationInit

# 定义变量站点名字
set mysite = gov_portal

# 设置网站重启后即初始化
appcmd set config "%mysite%/" /section:applicationInitialization /doAppInitAfterRestart:true /skipManagedModules:false

# 设置网站prepload
appcmd set app "%mysite%/" /preloadEnabled:true

appcmd list app %mysite% /xml | appcmd set apppool /in /processModel.idleTimeout:00:00:00

appcmd list app %mysite% /xml | appcmd set apppool /in /startMode:AlwaysRunning
展开
评论
Web Deploy 备份.NET Framework站点
# Global Backup Settings
- 可以手动改配置文件
%windir%\system32\inetsrv\config\applicationhost.config
- 也可以使用脚本来修改
%programfiles%\IIS\Microsoft Web Deploy V3\scripts\BackupScripts.ps1
打开PowerShell控制台:进入后,执行以下两个命令
进入目录:cd %programfiles%\IIS\Microsoft Web Deploy V3\scripts
加载脚本:. .\BackupScripts.ps1
TurnOn-Backups -On $true
Configure-Backups -Enabled $true
Configure-Backups -BackupPath "{SitePathParent}\Backups\{siteName}_snapshots"
Configure-Backups -NumberOfBackups 5
Configure-Backups -ContinueSyncOnBackupFailure $false

# 在单次发布时,禁用备份
msdeploy.exe -verb:sync -source:iisapp=<siteName> -dest:auto,computername=<remoteComputerName> -disablerule:BackupRule

learn.microsoft.com
展开
评论
# dirPath/filePath provider's ignoreErrors
msdeploy -verb:sync -source:contentPath=c:\Site1 -dest:contentPath=c:\Site2,dirpath.ignoreErrors=0x8000020;0x80070005,filepath.ignoreErrors=0x8000020;0x80070005

msdeploy -verb:sync -source:contentPath="C:\Test1" -dest:contentPath="C:\Test2" -usechecksum

# -skip跳过目录 、文件 等对象
-skip:skipAction=<action>,objectName=<objectName>,keyAttribute=<key>,absolutePath=<absolutePath>,attributes.<attributeName>=<attributeValue>,xPath=<xpathExpression>


Special Shortcuts

-skip:ApplicationPool=<applicationPoolName>
-skip:Directory=<directoryPath>
-skip:File=<filePath>
-skip:WebApplication=<webApplicationName>
-skip:WebSite=<webSitelName>

-skip:Directory=\\App_Data
reference: stackoverflow.com
reference: technet.microsoft.com

# -unicode选项,适配unicode字符
msdeploy -verb:dump -source:appHostConfig="Default Web Site",computerName=Server2,username="太郎",password="秘密" -unicode
展开
评论
retargeting from .net4.0/4.5 to .net4.8, including package.config& httpRuntime in Web.config

今天发现.net项目从4.5.1升级到.net 4.8之后,packages.config中还是有很
targetFramework="net40"、targetFramework="net45"、targetFramework="net451"、targetFramework="net452"、targetFramework="net46", 因此决定重新进行targeting处理。
<package id="ChnCharInfo" version="1.0.1" targetFramework="net40" />
<package id="EastAsiaNumericFormatter" version="1.0.0" targetFramework="net40" />

如何进行retargeting?
1. 在PackageConosole中执行Update-Package -Reinstall
PM> Update-Package -Reinstall
You are running the 'restore' operation with an 'http' source, 'http://xxx:65270/nuget'. Support for 'http' sources will be removed in a future version.

2. 在Web.config中将httpRuntime的targetFramework也改为4.8
<system.web>
<compilation debug="true" targetFramework="4.8" />
<httpRuntime targetFramework="4.8" maxRequestLength="7048576" executionTimeout="600" />
</system.web>
展开
Java分布式架构实战于2023-04-23 15:47发布的图片
Java分布式架构实战于2023-04-23 15:47发布的图片
评论
升级到.net48或部分程序集后, 会存在部分web站点的cshtml编译不过,从错误提示来看是缺少netstandard引用,按照提示在Web.config中增加程序集即可。

<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</assemblies>
</compilation>
<customErrors mode="Off"/>
展开
评论
今天研究了一下堡垒机打开terminal显示中文乱码的问题,有以下几个知识点:
1. 打开终端,查看当前使用的shell是什么:echo $SHELL
2. 如果shell是/bin/zsh, 那么其profile是~/.zshrc; 如果shell是/bin/sh或/bin/bash或其他什么,那么其profile是~/.bash_profile。
3.为了解决中文乱码,需要在profile中增加LANG相关设置
# You may need to manually set your language environment
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
增加配置后,使用source命令登基生效。
source ~/.zshrc
展开
1
体验了一下dotnet升级助手去分析.net4.8的工程,感觉还不错吧,希望后面能升级成功
.NET Upgrade Assistant - Get Started
dotnet.microsoft.com

Diagnostic UA0005 with the message HttpContext does not have a Current property; get the context from a controller or use HttpContextAccessor instead. generated

xDiagnostic UA0002 with the message This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent. generated
展开
4
「备忘录」60+Git常用命令行
juejin.cn
评论
# 在windows server上升级.net 4.8, 提示需要安装KB2919355
- [Windows Server 2012 R2 Update (KB2919355)](www.microsoft.com)

# 在windows server上安装dotnet6导致IIS应用程序池挂掉,在服务器管理》仪表板》工具》事件查看器》Windows 日志》应用程序中发现错误“模块DLL C:\Program Files (x86)\IIS\Asp.Net核心模块\V2\aspnetcorev2.dll加载失败”。经过百度\Bing发现,提示可能是缺少Microsoft Visual C++ 2015 Redistributable Update 3。
- [SSCMS 7.1 安装 .NET Core 托管包踩坑](www.jianshu.com)
展开
评论
试试在idea中使用墨菲安全怎么样?
Java分布式架构实战于2023-03-29 09:33发布的图片
评论
最近又回归一部分.NET 开发工作,又重新学习了.NET相关的知识。
首先避不开的是打开工程进行编译,先是从.net4.5升级到.net4.8.
然后又遇到各种安装包的问题,绑定重定向的问题。

问题:The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see go.microsoft.com
解决办法:在工具》Nuget包管理器》程序包管理器控制台中执行命令
重新安装依赖包
```
Update-Package -reinstall
```

问题:工程编译通过了,但是无法正常运行,提示打不到dll
解决办法:在工具》Nuget包管理器》程序包管理器控制台中执行命令
添加程序集缺失的绑定重定向
```
Add-BindingRedirect
```

# 参考资料
devblogs.microsoft.com
blog.csdn.net
展开
评论
下一页
个人成就
文章被点赞 40
文章被阅读 11,951
掘力值 506
收藏集
34
关注标签
10
加入于