我在Heroku docker上部署了。net应用部署进展顺利,没有错误但是当我试图打开应用程序时,我得到错误
尝试了一些事情,比如创建了名为PORT的VAR,并给出了5000的值,但没有锻炼
2023-01-22T12:30:50.674761+00:00 heroku[web.1]: Starting process with command `dotnet ./Muapp.dll --urls=http://*:5000`
2023-01-22T12:30:51.685276+00:00 app[web.1]: Welcome to Muapp!
2023-01-22T12:30:51.685567+00:00 app[web.1]:
2023-01-22T12:30:51.685571+00:00 app[web.1]:
2023-01-22T12:30:51.909353+00:00 app[web.1]: warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2023-01-22T12:30:51.909375+00:00 app[web.1]: Storing keys in a directory '/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
2023-01-22T12:30:51.928587+00:00 app[web.1]: warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
2023-01-22T12:30:51.928590+00:00 app[web.1]: No XML encryptor configured. Key {f5035bc0-d6dd-402b-92f8-51341dd3511a} may be persisted to storage in unencrypted form.
2023-01-22T12:30:54.638199+00:00 app[web.1]: info: Microsoft.Hosting.Lifetime[14]
2023-01-22T12:30:54.638211+00:00 app[web.1]: Now listening on: http://[::]:5000
2023-01-22T12:30:54.642119+00:00 app[web.1]: info: Microsoft.Hosting.Lifetime[0]
2023-01-22T12:30:54.642121+00:00 app[web.1]: Application started. Press Ctrl+C to shut down.
2023-01-22T12:30:54.642714+00:00 app[web.1]: info: Microsoft.Hosting.Lifetime[0]
2023-01-22T12:30:54.642715+00:00 app[web.1]: Hosting environment: Production
2023-01-22T12:30:54.642715+00:00 app[web.1]: info: Microsoft.Hosting.Lifetime[0]
2023-01-22T12:30:54.642716+00:00 app[web.1]: Content root path: /app
2023-01-22T12:31:50.857290+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2023-01-22T12:31:50.888117+00:00 heroku[web.1]: Stopping process with SIGKILL
2023-01-22T12:31:51.047126+00:00 heroku[web.1]: Process exited with status 137
2023-01-22T12:31:51.113768+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-22T13:53:20.502985+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=oby.herokuapp.com request_id=6e089f4e-52e2-4c32-b28f-efc7999777ac fwd="104.28.255.112" dyno= connect= service= status=503 bytes= protocol=https
2023-01-22T13:53:22.376963+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=oby.herokuapp.com request_id=824189c7-7244-4070-bccb-7af1b4584e78 fwd="104.28.255.112" dyno= connect= service= status=503 bytes= protocol=https
2023-01-22T13:53:27.109966+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=oby.herokuapp.com request_id=eb7e2b1b-37d4-471c-9514-43da912b827d fwd="104.28.255.112" dyno= connect= service= status=503 bytes= protocol=http
2023-01-22T13:53:28.779659+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=oby.herokuapp.com request_id=6c5c88ed-ac9a-4e70-b422-d0bf294baeb4 fwd="104.28.255.112" dyno= connect= service= status=503 bytes= protocol=http
Heroku为您分配了一个它希望您侦听的端口。该端口在一个名为port的环境变量中传递给您。所以你不能决定你想监听端口5000,因为这很可能不是Heroku分配给你的端口。
当Heroku发现您没有绑定到指定的端口时,它会杀死您的容器。
要绑定到正确的端口,将启动命令更改为
dotnet ./Muapp.dll --urls=http://*:${PORT}