I cant deploy a asp.api as a railway service
franklinjframe
FREEOP

8 months ago

SDK 9.0. It works with a mysql database and a angular frontend

Solved

42 Replies

passos
MODERATOR

8 months ago

hey, can you be more specific on what does not deploy? Did you try it?



medim
MODERATOR

8 months ago

he's trying to deploy an api inside /inmo/api


medim
MODERATOR

8 months ago

it's all ai generated


medim
MODERATOR

8 months ago

@AkuaFR


franklinjframe
FREEOP

8 months ago

i have a project using angular as frontend and an asp.net api as a backend
im trying to make a hosting for the app in, and the frontend loads just fine
but the backend has given me a lot of trouble
im trying with a docker file, but it is not working
right know, it shows me this
"dotnet restore" did not complete successfully: exit code: 1
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.


franklinjframe
FREEOP

8 months ago

what's this


passos
MODERATOR

8 months ago

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src

# Copy csproj and restore dependencies
COPY ["api.csproj", "./"]
RUN dotnet restore

# Copy the rest of the code
COPY . .
RUN dotnet build "api.csproj" -c Release -o /app/build
RUN dotnet publish "api.csproj" -c Release -o /app/publish /p:UseAppHost=false

# Final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "api.dll"]

can you try the dockerfile above?


passos
MODERATOR

8 months ago

make sure to set the following environment variables on your Railway service:

ASPNETCORE_URLS=http://0.0.0.0:8080
PORT=8080

franklinjframe
FREEOP

8 months ago

alright


franklinjframe
FREEOP

8 months ago

its not my project and u know


franklinjframe
FREEOP

8 months ago

im just helping


franklinjframe
FREEOP

8 months ago


franklinjframe
FREEOP

8 months ago

its giving the same msg


passos
MODERATOR

8 months ago

Nixpacks is not detecting that you're using a Dockerfile, in the Railway dashboard did you set a root directory?


franklinjframe
FREEOP

8 months ago

i did


passos
MODERATOR

8 months ago

Ok, then tell Railway to use it, add a RAILWAY_DOCKERFILE_PATH=Dockerfile environment variable to your service. If it fails to encounter that path, try to use the full path RAILWAY_DOCKERFILE_PATH=/inmo/api/Dockerfile


franklinjframe
FREEOP

8 months ago

it loaded
but it loaded the frontend instead of the backend
even tho it detected the docker file


passos
MODERATOR

8 months ago

Oh, then use the full path. Railway does not take into account the root directory that you set earlier.


franklinjframe
FREEOP

8 months ago

inside the dockerfile..


passos
MODERATOR

8 months ago

What do you mean?


franklinjframe
FREEOP

8 months ago

nvm


franklinjframe
FREEOP

8 months ago

give me a sec


franklinjframe
FREEOP

8 months ago

/inmo = loads the frontend
/inmo/api = error


passos
MODERATOR

8 months ago

what error does it give? paste full build logs


franklinjframe
FREEOP

8 months ago


passos
MODERATOR

8 months ago

are you sure you did change the Dockerfile? seems like it's using the old one


passos
MODERATOR

8 months ago

change this one, not the root one


franklinjframe
FREEOP

8 months ago

that's it


franklinjframe
FREEOP

8 months ago

got it


franklinjframe
FREEOP

8 months ago

it loaded the "API is running"


franklinjframe
FREEOP

8 months ago

now trying to make the http methods work


passos
MODERATOR

8 months ago

so everything's working?


franklinjframe
FREEOP

8 months ago

everything is running, yes
not necessarily working
still gotta fix the enrouting


franklinjframe
FREEOP

8 months ago

ill let you know


medim
MODERATOR

8 months ago

(he deployed it successfully, we talked in dms)


medim
MODERATOR

8 months ago

!s


Status changed to Solved medim 9 months ago


Status changed to Solved medim 9 months ago


franklinjframe
FREEOP

8 months ago

mmm


franklinjframe
FREEOP

8 months ago

!s


adam
MODERATOR

8 months ago

hmm…


adam
MODERATOR

8 months ago

!s


adam
MODERATOR

8 months ago

dammit


Loading...