fix:change port from 8081 -> 9291

This commit is contained in:
anjoy8 2021-08-24 15:21:25 +08:00
parent 3bdedfd28d
commit 496970984f
15 changed files with 40 additions and 20 deletions

View File

@ -37,5 +37,5 @@ RUN echo 'Asia/Shanghai' >/etc/timezone
#&& supervisord -c /etc/supervisord.conf
WORKDIR /app
COPY . .
EXPOSE 8081
EXPOSE 9291
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll","-b","0.0.0.0"]

View File

@ -29,7 +29,7 @@ namespace Blog.Core
//接入Apollo配置中心
config.AddConfigurationApollo("appsettings.apollo.json");
})
.UseUrls("http://*:8081")
.UseUrls("http://*:9291")
.ConfigureLogging((hostingContext, builder) =>
{
// 1.过滤掉系统默认的一些日志

View File

@ -15,7 +15,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": ""
},
"applicationUrl": "http://localhost:8081"
"applicationUrl": "http://localhost:9291"
},
"IIS Express": {
"commandName": "IISExpress",

View File

@ -1,5 +1,5 @@
{
"urls": "http://*:8081", //webIIS
"urls": "http://*:9291", //webIIS
"Logging": {
"LogLevel": {
"Default": "Information", //Defaultlog4net
@ -252,7 +252,7 @@
"ConsulSetting": {
"ServiceName": "BlogCoreService",
"ServiceIP": "localhost",
"ServicePort": "8081",
"ServicePort": "9291",
"ServiceHealthCheck": "/healthcheck",
"ConsulAddress": "http://localhost:8500"
},
@ -271,7 +271,7 @@
"Namespace": "public", //
"ListenInterval": 10000, //
"ServiceName": "blog.Core.Api", //
"Port": "8081", //
"Port": "9291", //
"RegisterEnabled": true // nacos
},
"LogFiedOutPutConfigs": {

View File

@ -15,13 +15,13 @@
$(document).ready(function () {
$("#jsonp").click(function () {
$.getJSON("http://localhost:8081/api/Login/jsonp?callBack=?", function (data) {
$.getJSON("http://localhost:9291/api/Login/jsonp?callBack=?", function (data) {
$("#data-jsonp").html("数据: " + data.value);
});
});
$("#cors").click(function () {
$.get("http://localhost:8081/api/Login/Token", function (data, status) {
$.get("http://localhost:9291/api/Login/Token", function (data, status) {
console.log(data);
$("#status-cors").html("状态: " + status);
$("#data-cors").html("数据: " + data? data.token:"失败");
@ -43,7 +43,7 @@
};
$.ajax({
type: 'post',
url: 'http://localhost:8081/api/Values',
url: 'http://localhost:9291/api/Values',
contentType: 'application/json',
data: JSON.stringify(postdata),
success: function (data, status) {

View File

@ -18,7 +18,7 @@
"bRemark": "string"
};
$.ajax({
url: "http://localhost:8081/api/Values",
url: "http://localhost:9291/api/Values",
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(postdata),
@ -34,7 +34,7 @@
<body>
<button id="btn">点击我请求数据</button>
<div id="requestMsg"></div>
<form id="sub1" method="post" action="http://localhost:8081/api/Values">
<form id="sub1" method="post" action="http://localhost:9291/api/Values">
<input name="name" type="text" />
<input type="submit" value="提交吧" />
</form>

View File

@ -2,7 +2,7 @@ git pull
@echo off
for /f "tokens=5" %%i in ('netstat -aon ^| findstr ":8081"') do (
for /f "tokens=5" %%i in ('netstat -aon ^| findstr ":9291"') do (
set n=%%i
)
taskkill /f /pid %n%

View File

@ -16,7 +16,7 @@
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8081
"Port": 9291
}
]
},

View File

@ -16,7 +16,7 @@
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8081
"Port": 9291
}
]
},

View File

@ -17,4 +17,4 @@ chmod 777 StopContainerImg.sh
./StopContainerImg.sh apkcontainer laozhangisphi/apkimg
docker build -t laozhangisphi/apkimg .
docker run --name=apkcontainer -d -v /data/blogcore/appsettings.json:/app/appsettings.json -v /data/blogcore/Log/:/app/Log -v /etc/localtime:/etc/localtime -it -p 8081:8081 laozhangisphi/apkimg
docker run --name=apkcontainer -d -v /data/blogcore/appsettings.json:/app/appsettings.json -v /data/blogcore/Log/:/app/Log -v /etc/localtime:/etc/localtime -it -p 9291:9291 laozhangisphi/apkimg

View File

@ -13,6 +13,6 @@ cd /home/Blog.Core/.PublishFiles
# 编译镜像
docker build -t laozhangisphi/apkimg .
# 生成容器
docker run --name=apkcontainer -d -v /etc/localtime:/etc/localtime -it -p 8081:8081 laozhangisphi/apkimg
docker run --name=apkcontainer -d -v /etc/localtime:/etc/localtime -it -p 9291:9291 laozhangisphi/apkimg
# 启动容器
docker start apkcontainer

View File

@ -197,7 +197,7 @@
"ConsulSetting": {
"ServiceName": "BlogCoreService",
"ServiceIP": "localhost",
"ServicePort": "8081",
"ServicePort": "9291",
"ServiceHealthCheck": "/healthcheck",
"ConsulAddress": "http://localhost:8500"
}

View File

@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
Blog.Core.Publish.Linux.sh = Blog.Core.Publish.Linux.sh
codecov.yml = codecov.yml
CreateYourProject.bat = CreateYourProject.bat
DockerBuild.bat = DockerBuild.bat
Dockerfile = Dockerfile
nuget.config = nuget.config
README.md = README.md
EndProjectSection
@ -53,7 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.ConsoleApp", "Blo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.Gateway", "Blog.Core.Gateway\Blog.Core.Gateway.csproj", "{A11C0DF2-1E13-4EED-BA49-44A57136B189}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blog.Core.Serilog.Es", "Blog.Core.Serilog.Es\Blog.Core.Serilog.Es.csproj", "{52AFAB53-D1CA-4014-8B63-3550FDCDA6E1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.Serilog.Es", "Blog.Core.Serilog.Es\Blog.Core.Serilog.Es.csproj", "{52AFAB53-D1CA-4014-8B63-3550FDCDA6E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

18
DockerBuild.bat Normal file
View File

@ -0,0 +1,18 @@
echo off
echo "Press B to build images, P to push to registry, any other key to cancel"
set /p op= :
if "%op%"=="B" goto build
if "%op%"=="P" goto push
exit
:build
docker rmi laozhangisphi/apkimg
docker build -f "Dockerfile" --force-rm -t laozhangisphi/apkimg .
goto end
:push
docker push laozhangisphi/apkimg
goto end
:end
pause

View File

@ -1,7 +1,7 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#这种模式是直接在构建镜像的内部编译发布dotnet项目。
#注意下容器内输出端口是8081
#注意下容器内输出端口是9291
#如果你想先手动dotnet build成可执行的二进制文件然后再构建镜像请看.Api层下的dockerfile。
@ -31,5 +31,5 @@ RUN dotnet publish "Blog.Core.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 8081
EXPOSE 9291
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll"]