■101227 / inTopicNo.8) |
Re[2]: ReactとASP.NETで通信エラー |
□投稿者/ tosh (2回)-(2023/01/19(Thu) 10:19:20)
|
皆様、ご回答ありがとうございます。
ご教授頂いた内容を元に以下のサイトバインドを追加しましたが、結果は同じでした。
種類:https
IPアドレス:未使用のIPアドレスすべて
ポート:443
HTTP/2を無効にする
SSL証明書:IIS Express Development Certificate
またIEから送信を試みましたが、ブラウザに入力欄もボタンも表示されないため断念しました。
以下に追加情報を記します。
<開発・実行環境>
OS:Windows10
npmバージョン:8.19.2
バックエンド開発:VisualStudio2017
テンプレート:ASP.NET Core Webアプリケーション
ASP.NET Core2.2 API
<フロントエンド側setupProxy.js>
const { createProxyMiddleware } = require('http-proxy-middleware');
const { env } = require('process');
const target = env.ASPNETCORE_HTTPS_PORT ? `https://localhost:${env.ASPNETCORE_HTTPS_PORT}` :
env.ASPNETCORE_URLS ? env.ASPNETCORE_URLS.split(';')[0] : 'https://localhost:44321';
const context = ["/api/"];
module.exports = function(app) {
const appProxy = createProxyMiddleware(context, {
target: target,
secure: false,
headers: {
Connection: 'Keep-Alive'
}
});
app.use(appProxy);
};
<バックエンド側launchSetting.json>
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:62768",
"sslPort": 44321
//"sslPort": 62768
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"TokaBackendApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
<フロントエンド開始時のログ>
C:\Users\sis\Documents\aspTestApp\ClientApp>npm start
> aspTestApp@0.1.0 prestart
> node aspnetcore-https && node aspnetcore-react
> aspTestApp@0.1.0 start
> rimraf ./build && react-scripts start
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
[HPM] Proxy created: /api/ -> https://localhost:44321
(node:12000) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:12000) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(node:12000) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
Starting the development server...
Compiled successfully!
You can now view aspTestApp in the browser.
Local: https://localhost:44454
On Your Network: https://192.168.77.17:44454
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
Files successfully emitted, waiting for typecheck results...
Issues checking in progress...
No issues found.
いくつか警告が出ているのが気になりますが、どうすれば改善するのか
調べてもよく分からないのが現状です。
|
|