UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-#Author#
[所有文章分類]
所有文章分類
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • Newtonsoft.Json.JsonConvert.DeserializeObject 失敗的情況
    test...more
  • dotnet ef dbcontext scaffold
    ...more
  • [ASP.NET] 利用 aspnet_regiis 加密 web.config
    ...more
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • [錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
    ...more
  • 用 Javascript 跨網頁讀取 cookie (Cookie cross page, path of cookie)
    ...more
  • 線上客服 - MSN
    本人信箱被盜用以致資料外洩,是否可以請貴平台予以協助刪除該信箱之使用謝謝囉...more
  • 插入文字到游標或選取處
    aaaaa...more
  • IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
    太感謝你了~~~你救了我被windows 認證卡了好幾天QQ...more
  • PostgreSQL 的 monitor trigger
    FOR EACH ROW 可能要改為 FOR EACH STATEMENT ...more
標籤
  • country
  • a
  • Big5 ORDER
  • debugWAITF
  • NxFRfXz6
  • end
  • 8 UNION AL
  • lock212112
  • 754
  • batch
  • 8
  • -9649 UNIO
  • 364
  • blog
  • 600
  • 152
  • connection
  • IP
  • 436
  • 102
  • array
  • 242
  • 438
  • 840
  • PW
  • 192
  • Content-Di
  • 50
  • 524
  • 318
  • @@Yk5Fc
  • sa
  • 978
  • EN
  • remote
  • AWS
  • wacs
  • OUTPUT
  • block
  • 276
  • 772
  • WU
  • CK
  • 87m2a6Br
  • 1421211211
  • grpstkizsh
  • 7327
  • @@5VcdF
  • JQ
  • html
頁數 15 / 53 上一頁 下一頁
搜尋 C 結果:
在 CentOS 上面啟動多個 .Net Core 的網站
1. 參考這裡設定第一個網站:
https://blog.johnwu.cc/article/centos-asp-net-core-neginx.html
注意, 文章中有一個錯誤:
/etc/nginx/conf.d/my-website.conf 的第 27 行, 應該是 include /etc/nginx/conf.d/default_proxy_settings;

2.  因為要避開 5000 port, 所以修改第二個網站的 appsettings.json, 讓第二個網站開在 5002 port, 如下.
{
"Logging": {
    "LogLevel": {
     "Default": "Information",
     "Microsoft": "Warning",
     "Microsoft.Hosting.Lifetime": "Information"
    }
},
"Kestrel": {
        "EndPoints": {
                "Http": {
                        "Url": "http://localhost:5002"
                }
        }
},
"AllowedHosts": "*"
}


3. 新增 /etc/nginx/conf.d/my-website2.conf, 要注意
    A. portal2
    B. server localhost:5002
    C. server_name coretest2.bike.idv.tw
    當然 SSL 憑証的檔名也要記得改.

upstream portal2 {
    # localhost:5000 改成 ASP.NET Core 所監聽的 Port
    server localhost:5002;
}

server {
    # 只要是透過這些 Domain 連 HTTP 80 Port,都會轉送封包到 ASP.NET Core
    listen 80;
    # 可透過空白區分,綁定多個 Domain
    server_name coretest2.bike.idv.tw;
    location / {
        proxy_pass http://portal2/;
        include /etc/nginx/conf.d/default_proxy_settings;
    }
}

# 用 HTTPS 必須要有 SSL 憑證,如果沒有要綁定 SSL 可以把下面整段移除
server {
    # 只要是透過這些 Domain 連 HTTPS 443 Port,都會轉送封包到 ASP.NET Core
    listen 443 ssl;
    server_name coretest2.bike.idv.tw;
    ssl_certificate /etc/nginx/ssl/coretest2.bike.idv.tw.crt;
    ssl_certificate_key /etc/nginx/ssl/coretest2.bike.idv.tw.key;

    location / {
        proxy_pass http://portal2/;
        include /etc/nginx/conf.d/default_proxy_settings;
    }
}


改完後就可以用了.

以下是 https://blog.johnwu.cc/article/centos-asp-net-core-neginx.html 抄過來的一些檔案, 作為備份:

setup-aspnet-core.sh
#!/bin/bash

main() {
    sudo yum -y install epel-release
    sudo yum -y update

    install_nginx
    install_dotnet

    sudo firewall-cmd --add-service=http --permanent
    sudo firewall-cmd --add-service=https --permanent
    sudo firewall-cmd --reload
}

install_nginx() {
    echo "###################################"
    echo "########## Install Nginx ##########"
    echo "###################################"
    sudo yum -y install httpd-tools nginx
    sudo setsebool -P httpd_can_network_connect on
    sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
    sudo setenforce 0
    sudo systemctl enable nginx
    sudo systemctl restart nginx
}

install_dotnet() {
    echo "###########################################"
    echo "########## Install .NET Core 2.2 ##########"
    echo "###########################################"
    sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
    sudo yum -y install aspnetcore-runtime-2.2
}

main "$@"


用以下指令執行:
sudo sh setup-aspnet-core.sh



/etc/systemd/system/my-website.service, (/bin/dotnet 有可能是 /usr/bin/dotnet)
[Unit]
# Description=<此服務的摘要說明>
Description=MyWebsite

[Service]
# WorkingDirectory=<ASP.NET Core 專案目錄>
WorkingDirectory=/usr/share/my-website

# ExecStart=/bin/dotnet <ASP.NET Core 起始 dll>
ExecStart=/bin/dotnet MyWebsite.dll

# 啟動若失敗,就重啟到成功為止
Restart=always
# 重啟的間隔秒數
RestartSec=10

# 設定環境變數,注入給 ASP.NET Core 用
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target


服務相關指令:
# 開啟,開機自動啟動服務
systemctl enable my-website.service

# 關閉,開機自動啟動服務
systemctl disable my-website.service

# 啟動服務
systemctl start my-website.service

# 重啟服務
systemctl restart my-website.service

# 停止服務
systemctl stop my-website.service

# 查看服務狀態
systemctl status my-website.service


/etc/nginx/conf.d/default_proxy_settings
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;


/etc/nginx/conf.d/my-website.conf
upstream portal {
    # localhost:5000 改成 ASP.NET Core 所監聽的 Port
    server localhost:5000;
}

server {
    # 只要是透過這些 Domain 連 HTTP 80 Port,都會轉送封包到 ASP.NET Core
    listen 80;
    # 可透過空白區分,綁定多個 Domain
    server_name demo.johnwu.cc example.johnwu.cc;
    location / {
        proxy_pass http://portal/;
        include /etc/nginx/conf.d/default_proxy_settings;
    }
}

# 用 HTTPS 必須要有 SSL 憑證,如果沒有要綁定 SSL 可以把下面整段移除
server {
    # 只要是透過這些 Domain 連 HTTPS 443 Port,都會轉送封包到 ASP.NET Core
    listen 443 ssl;
    server_name demo.johnwu.cc;
    ssl_certificate /etc/nginx/ssl/demo.johnwu.cc_bundle.crt;
    ssl_certificate_key /etc/nginx/ssl/demo.johnwu.cc.key;

    location / {
        proxy_pass http://portal/;
        include /etc/nginx/conf.d/default_proxy_settings;
    }
}


Nginx 重新啟動:
# 檢查 Nginx 的設定是否有誤
nginx -t

# 若沒有錯誤,即可套用
nginx -s reload
More...
Bike, 2020/7/7 上午 08:01:43
.Net Framework 升級 4.6.2 遇到的問題
可以參考:
https://support.microsoft.com/zh-tw/help/2971005/error-message-when-you-compile-applications-to-target-the-net-framewor

https://github.com/dotnet/standard/issues/542
More...
Bike, 2020/6/3 上午 09:02:20
SVN Commit 後可以修正 Message 之設定
因為希望大家 commit 程式都要寫一下訊息紀錄
但有人就是手快就 commit 了 ,事後要改卻跳出訊息告知不可以修改
查一下發現不是SVN設定檔加個勾勾就可以處理的,是要去 hooks 設定寫一段指令碼才可以
要去server端  去 Repository > 選 Properties > Hooks > 編輯 Pre-reversion property change hook

輸入以下指令
rem Only allow log messages to be changed.
if "%4" == "svn:log" exit 0
echo Property '%4' cannot be changed >&2
exit 1

  
 
 
 
 
More...
darren, 2020/3/20 下午 04:06:59
PANDA中午食記-悠活早午餐
https://www.foodpanda.com.tw/restaurant/e3cs/you-huo-zao-wu-can-vendor

宮保雞丁
有點辣 圓管粗麵

綜合蛋蛋餅
火腿起司薯餅

偏油 火腿比較鹹 整體而言普普

薯條
跟 綜合蛋蛋餅  比反而沒那麼油
好吃 可以點
More...
choco, 2020/2/25 上午 11:55:37
PANDA中午食記-SUNQ捲餅刀削麵(葷素餐廳)
https://www.foodpanda.com.tw/restaurant/e5nk/sunqjuan-bing-dao-xue-mian-hun-su-can-ting

海底撈刀削拌麵 (素, 胡麻醬) 推

宮保雞丁刀削炒麵  沒有不辣的選項

蔥爆牛肉刀削炒麵 
 
醬汁是甜的那種
優點:
牛肉不是乾乾的 是有汁的那種 也很軟 好吃
缺點:
以外送來說 有點乾 麵會黏在一起
很多胡椒粉,怕辣的人建議略過此餐點
More...
choco, 2020/2/25 上午 11:48:34
修改 Visual Studio 中的網站名稱
for VS2017: 在 sln 檔的目錄下, 找 .vs\config\applicationhost.config

例如: 
D:\ASP.NET Project\S3_WEB4_NET\.vs\config\applicationhost.config


For VS2019: $(solutionDir)\.vs\{slnName}\config\applicationhost.config
例如:
D:\ASP.NET Project\S3_WEB4_NET\.vs\S3\config\applicationhost.config
More...
Bike, 2020/1/31 下午 07:56:15
在 IIS 安裝 Let's Encrypt 的 SSL, 且可以設定自動更新
可以在這裡下載 

https://pkisharp.github.io/win-acme/

或是到

https://github.com/PKISharp/win-acme/releases 

下載 x64.pluggable.zip 的檔案

執行 wacs.exe,  然後看說明就可以囉.

wacs.exe --renew 會自動設定更新排程..

.100 可以在這裡找到檔案.
C:\Users\Administrator\win-acme

.195 可以在這裡找到
C:\Users\Administrator\win-acme.v2.1.6.773.x64.pluggable
More...
Bike, 2019/12/13 下午 06:32:01
MSDTC 交易管理員無法使用
為了使用 TransactionScope, 所以要啟到 DTC(Distributed Transaction Coordinator),分散式交易協調器看了很多文章後發現.

最後還是要看一下事件檢視器.

可以重裝再設定 MSDTC 哦.

重裝MSDTC, 可以用 CMD, 輸入以下指令.
"msdtc -uninstall"
“msdtc -install”
More...
Bike, 2019/11/25 上午 11:57:06
使用 Swiper 時, Mobile 版不能設定 slidesPerGroup, 否則會看到最後一組商品.
有點怪的 bug, mobile 版的 slidesPerGroup 只能設為 1

    var slidesPerGroup = 5;
    if (S3JS.isMobile()) {
        slidesPerGroup = 1; // 很奇怪, Mobile 版時, 若是設定 slidesPerGroup = 5 時, 剛進入時會看到最後一組商品.
    }
    //beauty-coin-exchange-loading
    var swiperPreview = new Swiper('.beauty-coin-exchange-swiper', {
        slidesPerView: 5,
        slidesPerColumn: 1,
        slidesPerGroup: slidesPerGroup,
        spaceBetween: 0,
        loop: true,
        breakpoints: {
            768: {
                slidesPerView: 4.3,
                spaceBetween: 10,
            }
        },
        nextButton: '.beauty-coin-next',
        prevButton: '.beauty-coin-prev',
    });
More...
Bike, 2019/11/22 下午 04:41:11
在 MySQL 建立 Cache 用的 Trigger
use clinic;

INSERT INTO change_notification(`table_name`) VALUES('sys_config');

drop trigger if exists au_sys_config;
drop trigger if exists ai_sys_config;
drop trigger if exists ad_sys_config;

delimiter |

CREATE TRIGGER au_sys_config after UPDATE ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

CREATE TRIGGER ai_sys_config after INSERT ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

CREATE TRIGGER ad_sys_config after Delete ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

delimiter ;
More...
Bike, 2019/11/6 下午 07:17:50
|< …6789101112131415… >|
頁數 15 / 53 上一頁 下一頁
~ Uwinfo ~