You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
3.6 KiB
Plaintext

4 months ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"source": [
"# HttpClient 测试"
]
},
{
"cell_type": "markdown",
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
},
"vscode": {
"languageId": "polyglot-notebook"
}
},
"source": [
"## 1、引用项目Dll"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
},
"vscode": {
"languageId": "polyglot-notebook"
}
},
"outputs": [],
"source": [
"//引用项目\n",
"#r \"./Publish/HttpClientStudy.Core/HttpClientStudy.Core.dll\"\n",
"\n",
"using HttpClientStudy.Core.Utilities;\n",
"var result = CmdUtility.RunCmd(\"ls\");\n",
"Console.WriteLine(result);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 启动项目"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
},
"vscode": {
"languageId": "polyglot-notebook"
}
},
"outputs": [
{
"ename": "Error",
"evalue": "Command failed: SubmitCode: #启动项目 ...",
"output_type": "error",
"traceback": [
"Command failed: SubmitCode: #启动项目 ..."
]
}
],
"source": [
"#启动项目\n",
"Start-Process -FilePath \".\\Publish\\HttpClientStudy.WebApp\\HttpClientStudy.WebApp.exe\""
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
},
"vscode": {
"languageId": "polyglot-notebook"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[31;1mGet-Process: \u001b[0m\n",
"\u001b[31;1m\u001b[36;1mLine |\u001b[0m\n",
"\u001b[31;1m\u001b[36;1m\u001b[36;1m 3 | \u001b[0m $WebAppProc = \u001b[36;1mGet-Process $WebAppProcName\u001b[0m\n",
"\u001b[31;1m\u001b[36;1m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[0m\u001b[36;1m | \u001b[31;1m ~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m\n",
"\u001b[31;1m\u001b[36;1m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[31;1m\u001b[31;1m\u001b[36;1m | \u001b[31;1mCannot find a process with the name \"HttpClientStudy.WebApp\". Verify the process name and call the cmdlet again.\u001b[0m\n"
]
},
{
"ename": "Error",
"evalue": "Command failed: SubmitCode: # 关闭项目进程 ...",
"output_type": "error",
"traceback": [
"Command failed: SubmitCode: # 关闭项目进程 ..."
]
}
],
"source": [
"# 关闭项目进程\n",
"$WebAppProcName =\"HttpClientStudy.WebApp\";\n",
"$WebAppProc = Get-Process $WebAppProcName\n",
"if($WebAppProc -ne $null)\n",
"{\n",
" Stop-Process $WebAppProc.Id\n",
"}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "python"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}