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

a year ago

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

Solved

42 Replies

a year ago

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



a year ago

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


a year ago

it's all ai generated


a year ago

@AkuaFR


franklinjframe
FREEOP

a year 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

a year ago

what's this


a year 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?


a year 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

a year ago

alright


franklinjframe
FREEOP

a year ago

its not my project and u know


franklinjframe
FREEOP

a year ago

im just helping


franklinjframe
FREEOP

a year ago


franklinjframe
FREEOP

a year ago

its giving the same msg


a year ago

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


franklinjframe
FREEOP

a year ago

i did


a year 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

a year ago

it loaded

but it loaded the frontend instead of the backend

even tho it detected the docker file


a year ago

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


franklinjframe
FREEOP

a year ago

inside the dockerfile..


a year ago

What do you mean?


franklinjframe
FREEOP

a year ago

nvm


franklinjframe
FREEOP

a year ago

give me a sec


franklinjframe
FREEOP

a year ago

/inmo = loads the frontend

/inmo/api = error


a year ago

what error does it give? paste full build logs


franklinjframe
FREEOP

a year ago


a year ago

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


a year ago

change this one, not the root one


franklinjframe
FREEOP

a year ago

that's it


franklinjframe
FREEOP

a year ago

got it


franklinjframe
FREEOP

a year ago

it loaded the "API is running"


franklinjframe
FREEOP

a year ago

now trying to make the http methods work


a year ago

so everything's working?


franklinjframe
FREEOP

a year ago

everything is running, yes

not necessarily working

still gotta fix the enrouting


franklinjframe
FREEOP

a year ago

ill let you know


a year ago

(he deployed it successfully, we talked in dms)


a year ago

!s


Status changed to Solved medim 12 months ago


franklinjframe
FREEOP

a year ago

mmm


franklinjframe
FREEOP

a year ago

!s


a year ago

hmm...


a year ago

!s


a year ago

dammit


Welcome!

Sign in to your Railway account to join the conversation.

Loading...