TL; DR:为什么aspnet核心应用程序在Docker镜像中的端口80上运行,但在docker镜像之外运行5000.
阐述
我浏览了这里的aspnet核心/ docker教程:https: //docs.microsoft.com/en-us/dotnet/core/docker/building-net-docker-images
在页面的一半,我按照规定启动应用程序:
dotnet run
Run Code Online (Sandbox Code Playgroud)
除此之外,这打印这个:
Now Listening on: http://localhost:5000
Run Code Online (Sandbox Code Playgroud)
大.这就是我的预期.本教程的下一步是从Docker镜像中启动完全相同的应用程序.
docker build -t aspnetapp .
docker run -it --rm -p 5000:80 --name aspnetcore_sample aspnetapp
Run Code Online (Sandbox Code Playgroud)
这导致了
Now listening on: http://[::]:80
Run Code Online (Sandbox Code Playgroud)
等待.笏?为什么aspnet核心应用程序在端口80上运行?当我直接从机器运行它时,它在端口5000上运行.没有配置文件更改.
我怀疑它与基本的docker图像有关,但是在docker中还不够熟练以跟踪它.
我最近一直在学习很多关于Maven的事情并且给我留下了非常深刻的印象.我在哪里可以找到有关与Maven相同的方式与存储库进行通信,部署和检索的信息?这是通过一些公布的协议完成的吗?
我找到了有关OSGI(和OBR)的信息,但无法判断这是否是我应该研究的内容.
我想在.net(无论出于何种原因)这样做.如果有人能指出我正确的组件,我不介意查看java源代码,但更倾向于指向协议规范.
[编辑]我看到很多关于HTTP的答案.我想进一步澄清,我不是在寻找传输协议,我正在寻找API协议.例如,简单对象访问协议(SOAP)使用超文本传输协议来传输消息.Maven的访问协议是什么?
这个gulp文件有什么问题?当它打开浏览器时,它不会显示index.html.相反,它列出了'dist'的内容,即包含index.html的目录.
"use strict";
var gulp = require('gulp');
var connect = require('gulp-connect'); // Runs a local dev server
var open = require('gulp-open');
var config = {
port: 9005,
devBaseUrl: 'http://localhost',
paths: {
html: './src/*.html',
dist: './dist'
}
};
//Start a local development server
gulp.task('connect', function() {
connect.server({
root: ['dist'],
port: config.port,
base: config.devBaseUrl,
livereload: true
});
});
gulp.task('open', ['connect'], function () {
gulp.src('dist/index.html')
.pipe(open({
uri: config.devBaseUrl + ':' + config.port + '/',
app: 'chrome' }));
});
gulp.task('html', function() {
gulp.src(config.paths.html)
.pipe(gulp.dest(config.paths.dist)) …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个Asp.net WebApi /单页面应用程序.如果没有给出路由,我希望我的服务器分配index.html.我希望它以正常的"{controller}/{id}"方式指定一个控制器.
我意识到我可以使用http:// localhost:555/index.html访问我的索引页面.我如何通过访问http:// localhost:555来做同样的事情?
使用一些样板代码,我可以使我的电子应用程序在Visual Studio代码中工作。我可以打到main.js的断点,但是不能打断我的任何打字稿/反应代码。我正在使用webpack进行构建,但是还没有结婚。如何为React东西连接调试器?
我开始与这些穿行:medium.com和typescriptlang.org
这是我的配置文件
launch.js
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"preLaunchTask": "webpack",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"program": "${workspaceFolder}/main.js",
"runtimeArgs": [
".",
"--enable-logging"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
task.js
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "webpack",
"command": "webpack",
"args": …Run Code Online (Sandbox Code Playgroud) 我试图从查询中获取Envelope.信封定义如下.
[<CLIMutable>]
type Envelope<'T> = {
Id : Guid
StreamId: Guid
Created : DateTimeOffset
Item : 'T }
Run Code Online (Sandbox Code Playgroud)
MyLibAAS.DataStore.MyLibAASDbContext是用c#编写的EF DbContext.当我在f#中扩展它时,我得到错误:Only parameterless constructors and initializers are supported in LINQ to Entities.
type MyLibAAS.DataStore.MyLibAASDbContext with
member this.GetEvents streamId =
query {
for event in this.Events do
where (event.StreamId = streamId)
select {
Id = event.Id;
StreamId = streamId;
Created = event.Timestamp;
Item = (JsonConvert.DeserializeObject<QuestionnaireEvent> event.Payload)
}
}
Run Code Online (Sandbox Code Playgroud)
如果我返回事件并在事后将其映射到Envelope,它可以正常工作.
type MyLibAAS.DataStore.MyLibAASDbContext with
member this.GetEvents streamId =
query {
for event in this.Events …Run Code Online (Sandbox Code Playgroud) 我在f#交互式窗口中玩游戏,发现printf没有像我预期的那样工作.在下面的代码片段中,ReadLine在第一个printf之前执行
let run () =
printf "What is your name?"
Console.Out.Flush()
let value = System.Console.ReadLine()
printf "Hello, %s, nice to meet you!" value
run()
Run Code Online (Sandbox Code Playgroud)
如果我将printf更改为Console.WriteLine它按预期工作.
let run () =
Console.Out.WriteLine "What is your name?"
Console.Out.Flush()
let value = System.Console.ReadLine()
printf "Hello, %s, nice to meet you!" value
run()
Run Code Online (Sandbox Code Playgroud)
printf发生了什么?是否有flush电话我可以在readline之前打印它?我应该使用f#readline吗?
----------------- [编辑] --------------------
在阅读了Fyodor Soikin的回答之后,我尝试了以下方法来验证.果然,打印到屏幕上的内容是Hello在我输入一些输入之后打印出来的World.
open System
let run () =
printf "Hello\n World"
let value = System.Console.ReadLine()
let msg = sprintf "Hello, %s, nice …Run Code Online (Sandbox Code Playgroud) 我最近在接受采访时被问到这个问题.
假设有一个庞大的C程序库,每个程序都有malloc()s和free()s块的数据.如果你的程序中有一百万次调用malloc()和free()一次运行,你认为会发生什么?如果给你一个非常大的内存堆存储,你会给你的答案添加什么?
我正在努力成为一名优秀的 powerscript 用户,并根据最佳实践使用 Write-Verbose,但我无法从正在运行的作业中获取 Verbose 流。
$Job = Start-Job -Name "Scanning Work Item" -ScriptBlock{
Write-Verbose "Write-Verbose"
Write-Host "Write-Host"
}
while ($Job.HasMoreData -or $Job.State -eq "Running") {
Receive-Job -Job $Job -Verbose
Start-Sleep -Seconds 1
}
Run Code Online (Sandbox Code Playgroud)
其输出是
Write-Host
Run Code Online (Sandbox Code Playgroud)
请只用经过测试的代码来回答,因为我已经花了几个小时尝试 Powershell 脚本的各种排列。