mirror of
https://github.com/anjoy8/Blog.Core.git
synced 2024-09-20 23:48:27 +08:00
fix:change port from 8081 -> 9291
This commit is contained in:
parent
3bdedfd28d
commit
496970984f
|
@ -37,5 +37,5 @@ RUN echo 'Asia/Shanghai' >/etc/timezone
|
||||||
#&& supervisord -c /etc/supervisord.conf
|
#&& supervisord -c /etc/supervisord.conf
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
EXPOSE 8081
|
EXPOSE 9291
|
||||||
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll","-b","0.0.0.0"]
|
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll","-b","0.0.0.0"]
|
|
@ -29,7 +29,7 @@ namespace Blog.Core
|
||||||
//接入Apollo配置中心
|
//接入Apollo配置中心
|
||||||
config.AddConfigurationApollo("appsettings.apollo.json");
|
config.AddConfigurationApollo("appsettings.apollo.json");
|
||||||
})
|
})
|
||||||
.UseUrls("http://*:8081")
|
.UseUrls("http://*:9291")
|
||||||
.ConfigureLogging((hostingContext, builder) =>
|
.ConfigureLogging((hostingContext, builder) =>
|
||||||
{
|
{
|
||||||
// 1.过滤掉系统默认的一些日志
|
// 1.过滤掉系统默认的一些日志
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": ""
|
"ASPNETCORE_ENVIRONMENT": ""
|
||||||
},
|
},
|
||||||
"applicationUrl": "http://localhost:8081"
|
"applicationUrl": "http://localhost:9291"
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"urls": "http://*:8081", //web服务端口,如果用IIS部署,把这个去掉
|
"urls": "http://*:9291", //web服务端口,如果用IIS部署,把这个去掉
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information", //加入Default否则log4net本地写入不了日志
|
"Default": "Information", //加入Default否则log4net本地写入不了日志
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
"ConsulSetting": {
|
"ConsulSetting": {
|
||||||
"ServiceName": "BlogCoreService",
|
"ServiceName": "BlogCoreService",
|
||||||
"ServiceIP": "localhost",
|
"ServiceIP": "localhost",
|
||||||
"ServicePort": "8081",
|
"ServicePort": "9291",
|
||||||
"ServiceHealthCheck": "/healthcheck",
|
"ServiceHealthCheck": "/healthcheck",
|
||||||
"ConsulAddress": "http://localhost:8500"
|
"ConsulAddress": "http://localhost:8500"
|
||||||
},
|
},
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
"Namespace": "public", // 命名空间
|
"Namespace": "public", // 命名空间
|
||||||
"ListenInterval": 10000, // 监听的频率
|
"ListenInterval": 10000, // 监听的频率
|
||||||
"ServiceName": "blog.Core.Api", // 服务名
|
"ServiceName": "blog.Core.Api", // 服务名
|
||||||
"Port": "8081", // 服务端口号
|
"Port": "9291", // 服务端口号
|
||||||
"RegisterEnabled": true // 是否直接注册nacos
|
"RegisterEnabled": true // 是否直接注册nacos
|
||||||
},
|
},
|
||||||
"LogFiedOutPutConfigs": {
|
"LogFiedOutPutConfigs": {
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#jsonp").click(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);
|
$("#data-jsonp").html("数据: " + data.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#cors").click(function () {
|
$("#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);
|
console.log(data);
|
||||||
$("#status-cors").html("状态: " + status);
|
$("#status-cors").html("状态: " + status);
|
||||||
$("#data-cors").html("数据: " + data? data.token:"失败");
|
$("#data-cors").html("数据: " + data? data.token:"失败");
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
url: 'http://localhost:8081/api/Values',
|
url: 'http://localhost:9291/api/Values',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: JSON.stringify(postdata),
|
data: JSON.stringify(postdata),
|
||||||
success: function (data, status) {
|
success: function (data, status) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"bRemark": "string"
|
"bRemark": "string"
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "http://localhost:8081/api/Values",
|
url: "http://localhost:9291/api/Values",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
contentType: "application/json; charset=utf-8",
|
contentType: "application/json; charset=utf-8",
|
||||||
data: JSON.stringify(postdata),
|
data: JSON.stringify(postdata),
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<body>
|
<body>
|
||||||
<button id="btn">点击我请求数据</button>
|
<button id="btn">点击我请求数据</button>
|
||||||
<div id="requestMsg"></div>
|
<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 name="name" type="text" />
|
||||||
<input type="submit" value="提交吧" />
|
<input type="submit" value="提交吧" />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -2,7 +2,7 @@ git pull
|
||||||
|
|
||||||
|
|
||||||
@echo off
|
@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
|
set n=%%i
|
||||||
)
|
)
|
||||||
taskkill /f /pid %n%
|
taskkill /f /pid %n%
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "localhost",
|
"Host": "localhost",
|
||||||
"Port": 8081
|
"Port": 9291
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "localhost",
|
"Host": "localhost",
|
||||||
"Port": 8081
|
"Port": 9291
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,4 +17,4 @@ chmod 777 StopContainerImg.sh
|
||||||
./StopContainerImg.sh apkcontainer laozhangisphi/apkimg
|
./StopContainerImg.sh apkcontainer laozhangisphi/apkimg
|
||||||
|
|
||||||
docker build -t 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
|
|
@ -13,6 +13,6 @@ cd /home/Blog.Core/.PublishFiles
|
||||||
# 编译镜像
|
# 编译镜像
|
||||||
docker build -t laozhangisphi/apkimg .
|
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
|
docker start apkcontainer
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
"ConsulSetting": {
|
"ConsulSetting": {
|
||||||
"ServiceName": "BlogCoreService",
|
"ServiceName": "BlogCoreService",
|
||||||
"ServiceIP": "localhost",
|
"ServiceIP": "localhost",
|
||||||
"ServicePort": "8081",
|
"ServicePort": "9291",
|
||||||
"ServiceHealthCheck": "/healthcheck",
|
"ServiceHealthCheck": "/healthcheck",
|
||||||
"ConsulAddress": "http://localhost:8500"
|
"ConsulAddress": "http://localhost:8500"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
|
||||||
Blog.Core.Publish.Linux.sh = Blog.Core.Publish.Linux.sh
|
Blog.Core.Publish.Linux.sh = Blog.Core.Publish.Linux.sh
|
||||||
codecov.yml = codecov.yml
|
codecov.yml = codecov.yml
|
||||||
CreateYourProject.bat = CreateYourProject.bat
|
CreateYourProject.bat = CreateYourProject.bat
|
||||||
|
DockerBuild.bat = DockerBuild.bat
|
||||||
|
Dockerfile = Dockerfile
|
||||||
nuget.config = nuget.config
|
nuget.config = nuget.config
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
@ -53,7 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.ConsoleApp", "Blo
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.Gateway", "Blog.Core.Gateway\Blog.Core.Gateway.csproj", "{A11C0DF2-1E13-4EED-BA49-44A57136B189}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.Core.Gateway", "Blog.Core.Gateway\Blog.Core.Gateway.csproj", "{A11C0DF2-1E13-4EED-BA49-44A57136B189}"
|
||||||
EndProject
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
18
DockerBuild.bat
Normal file
18
DockerBuild.bat
Normal 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
|
|
@ -1,7 +1,7 @@
|
||||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||||
|
|
||||||
#这种模式是直接在构建镜像的内部编译发布dotnet项目。
|
#这种模式是直接在构建镜像的内部编译发布dotnet项目。
|
||||||
#注意下容器内输出端口是8081
|
#注意下容器内输出端口是9291
|
||||||
#如果你想先手动dotnet build成可执行的二进制文件,然后再构建镜像,请看.Api层下的dockerfile。
|
#如果你想先手动dotnet build成可执行的二进制文件,然后再构建镜像,请看.Api层下的dockerfile。
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,5 +31,5 @@ RUN dotnet publish "Blog.Core.Api.csproj" -c Release -o /app/publish
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
EXPOSE 8081
|
EXPOSE 9291
|
||||||
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll"]
|
ENTRYPOINT ["dotnet", "Blog.Core.Api.dll"]
|
Loading…
Reference in New Issue
Block a user