小编Moh*_*hid的帖子

Windows 子系统 linux 2 (wsl2) 下的 ubuntu 无法访问互联网

我在 wsl 1 下有一个 ubuntu 工作正常并连接到互联网

只是升级到 wsl2 ,我无法从 bash ping google.com

但如果我降级到 wsl1,我可以 ping

问题在这里:[WSL2] 没有网络 · 问题 #4731 · microsoft/WSL


我试过这个但没有用

第 1 步:以管理员身份打开 Hyper-V 管理器

在此处输入图片说明

步骤 2:从操作中选择 Virtual Switch Manager

在此处输入图片说明

第 3 步:选择 WLS

在此处输入图片说明

第 4 步:选择选择的外部网络和适配器连接到互联网

在此处输入图片说明


我的 windows ipconfig 以太网适配器 vEthernet (WSL):

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::30a4:2612:6ee3:2390%142
   IPv4 Address. . . . . . . . . . . : 192.168.0.103 …
Run Code Online (Sandbox Code Playgroud)

hyper-v windows-subsystem-for-linux

12
推荐指数
3
解决办法
4万
查看次数

如何在[Windows路径]中设置[在Windows上使用Ubuntu进行Bash] [环境变量]?

尝试在Windows 上使用Bash 使用samza.apache.org/startup/hello-samza/0.7.0/

它会运行

bin/grid bootstrap
Run Code Online (Sandbox Code Playgroud)

流动的代码在哪里

if [ -z "$JAVA_HOME" ]; then
  if [ -x /usr/libexec/java_home ]; then
    export JAVA_HOME="$(/usr/libexec/java_home)"
  else
    echo "JAVA_HOME not set. Exiting."
    exit 1
  fi
fi
Run Code Online (Sandbox Code Playgroud)

给出错误

JAVA_HOME not set. Exiting.
Run Code Online (Sandbox Code Playgroud)

在我运行时在CMD上

echo %JAVA_HOME%
Run Code Online (Sandbox Code Playgroud)

我有

C:\Program Files (x86)\Java\jdk1.8.0_102\
Run Code Online (Sandbox Code Playgroud)

我想将路径数据导入bash

在此输入图像描述

bash ubuntu command-line windows-10 windows-subsystem-for-linux

5
推荐指数
1
解决办法
2万
查看次数

如何在 Program.Main 上将 SetBasePath 设置为 dll 位置

启动 dotnet dll 时

 cd /
 dotnet /tmp/donetproject/donetproject.dll
Run Code Online (Sandbox Code Playgroud)

编码

.AddJsonFile("hostsettings.json", optional: true)
Run Code Online (Sandbox Code Playgroud)

会看

/hostsettings.json

不是

/tmp/donetproject/hostsettings.json

设置 GetCurrentDirectory 无效

.SetBasePath(Directory.GetCurrentDirectory())
Run Code Online (Sandbox Code Playgroud)
public class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }
    public static IWebHostBuilder CreateWebHostBuilder(string[] args)
    {
        var config = new ConfigurationBuilder()
            .SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile("hostsettings.json", optional: true)
            .AddCommandLine(args)
            .Build();

        return WebHost.CreateDefaultBuilder(args)
            .UseUrls()
            .UseConfiguration(config)
                .UseStartup<Startup>();
    }
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core-mvc asp.net-core

4
推荐指数
1
解决办法
1004
查看次数

错误:未找到:'dart:html' 使用带有颤动的 googleapis_auth dart 团队包时

使用时

使用此代码通过 Flutter 访问 Google Api

import 'dart:convert';
import 'dart:io';

import 'package:googleapis_auth/auth.dart';
import 'package:googleapis_auth/auth_browser.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'package:googleapis/androidpublisher/v3.dart';

Future main() async {
  dynamic jsonData = json.decode(
      await File('api-xxxxxxxxxxxxxxxxxxxx.json')
          .readAsString());
  var scopes = [AndroidpublisherApi.AndroidpublisherScope];
  final accountCredentials = new ServiceAccountCredentials.fromJson(jsonData);

  AuthClient client = await clientViaServiceAccount(accountCredentials, scopes);


}
Run Code Online (Sandbox Code Playgroud)

你会得到这个错误

错误:未找到:'dart:html' 将 'dart:html' 导入为 html;

google-api dart flutter

2
推荐指数
1
解决办法
4210
查看次数