Visual Studio 2017 连接Azure设置

由于众所周知的原因导致微软的Azure平台分为Global Azure和由世纪互联运营的中国区 Azure,并且数据互不相通。目前Global Azure已经可以用国内的电话号码验证。准备一张Visa或者Master信用卡就可以愉快的使用了。今天在切换国区账号和全球账号遇到一些坑,整理记录一下。

使用 Visual Studio 2017,连接中国区 Azure

新建一个 JSON 文件 AadProvider.Configuration.json,文件内容如下

{
"AuthenticationQueryParameters": null,
"AsmEndPoint": "https://management.core.chinacloudapi.cn",
"Authority": "https://login.chinacloudapi.cn/",
"AzureResourceManagementEndpoint": "https://management.chinacloudapi.cn/",
"AzureResourceManagementAudienceEndpoints": [ "https://management.core.chinacloudapi.cn/" ],
"ClientIdentifier": "872cd9fa-d31f-45e0-9eab-6e460a02d1f1",
"EnvironmentName": "Mooncake",
"GraphEndpoint": "https://graph.chinacloudapi.cn",
"MsaHomeTenantId": "f577cd82-810c-43f9-a1f6-0cc532871050",
"NativeClientRedirect": "urn:ietf:wg:oauth:2.0:oob",
"PortalEndpoint": "http://manage.windowsazure.cn",
"ResourceEndpoint": "https://management.core.chinacloudapi.cn/",
"ValidateAuthority": true,
"VisualStudioOnlineEndpoint": "https://app.vssps.visualstudio.com/",
"VisualStudioOnlineAudience": "499b84ac-1321-427f-aa17-267ca6975798"
}
  1. 确保已登出并关闭 Visual Studio。
  2. 删除 %temp%\servicehub 文件夹(详细路径为 C:\Users%USERPROFILE%\AppData\Local\Temp\servicehub)。
  3. 把前面新建的 JSON 文件 (AadProvider.Configuration.json) 拷贝到 %localappdata%.IdentityService\AadConfigurations(详细路径为 C:\Users%USERPROFILE%\AppData\Local.IdentityService\AadConfigurations, AadConfigurations 文件夹可能不存在,需要手动创建)。
  4. 重启 VS 并添加中国 Azure 账户即可。

使用 Visual Studio 2017,连接Global Azure

  1. 确保已登出并关闭 Visual Studio。
  2. 删除文件夹。%localappdata%.IdentityService\AadConfigurations
  3. 重启 VS 即可连接 Global Azure。

切换Global Azure方法为官方解决方案,但实际操作过程中,会导致Visual Studio 登录账号失败,要求重复验证,无法切换。正确做法如下。

  1. 确保已登出并关闭 Visual Studio。
  2. 删除文件夹。%localappdata%.IdentityService\内的所有文件
  3. 打开全局代理(非必需 网络不稳定情况下使用)
  4. 重启VS即可重新连接 Global Azure

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

未能加载文件或程序集“xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。试图加载格式不正确的程序。


原因:操作系统是64位的,但发布的程序引用了一些32位的ddl,所以出现了兼容性的问题
解决方案一:如果是64位机器,IIS——应用程序池——高级设置——启用32位应用程序 :True
解决方案二:修改项目属性——生成——目标平台(比如,X86\X64)

Centos系统VPS主机初始化脚本整理

常用命令
sudo su #切换root
yum update #更新系统
last #登录成功的用户信息
last | less #最新的登录记录在最前面,所以可以用 一下命令来查看
lastb #查看登录失败的用户信息
tail /var/log/secure #查看登录日志
echo > /var/log/btmp #清除登陆系统失败的记录
安装最新内核并开启 BBR

参考秋水逸冰博客

使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

安装完成后,脚本会提示需要重启 VPS,输入 y 并回车后重启。
重启完成后,进入 VPS,验证一下是否成功安装最新内核并开启 TCP BBR,输入以下命令:

uname -r

查看内核版本,显示为最新版就表示 OK 了

sysctl net.ipv4.tcp_available_congestion_control

返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno

sysctl net.ipv4.tcp_congestion_control

返回值一般为:
net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc

返回值一般为:
net.core.default_qdisc = fq

lsmod | grep bbr

返回值有 tcp_bbr 模块即说明 bbr 已启动。注意:并不是所有的 VPS 都会有此返回值,若没有也属正常。

科学上网

参考秋水逸冰博客

常规版 Windows 客户端
https://github.com/shadowsocks/shadowsocks-windows/releases
ShadowsocksR 版 Windows 客户端
https://github.com/shadowsocksrr/shadowsocksr-csharp/releases

使用root用户登录,运行以下命令:

wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
chmod +x shadowsocks-all.sh
./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log
Kcptun服务端

参考扩软博客
确定加速端口

netstat -nl | grep 8388

脚本信息

wget --no-check-certificate https://github.com/kuoruan/shell-scripts/raw/master/kcptun/kcptun.sh
chmod +x ./kcptun.sh
./kcptun.sh
安装宝塔面板
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh