✅ asp.net 6.0 + EntityFramework + IIS
I have a Web Api project, I set my ConnectionString on appsettings.json. In Program.cs I used the connection string to link with my DbContext. When I run the project on Visual Studio it works perfectly, when I publish it with IIS it doesn't work, it says "Page is not working". When I replace "return await _context.SalesData.ToListAsync();" with a handwritten data, page loads and shows the data so IIS works but EntityFramework doesn't work when published I believe. I couldn't find a solution anywhere, if anyone knows what I'm missing please help!
72 Replies
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I ran with the .exe now it worked this way it shows the data
so IIS problem?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I published with this option before should I try doing the dotnet publish
When I publish like this I get a .exe
TeBeCo
you also probably should use
dotnet publish
and not the publish
from VSQuoted by
<@689473681302224947> from #asp.net 6.0 + EntityFramework + IIS (click here)
React with ❌ to remove this embed.
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
It was inside a folder I created inside inetpub\wwwroot
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yes unfortunately
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
just created a folder called iis and published it there, changed the path from IIS
still it says page is not working
this WeatherForecast controller was auto created when i create my web api project, it works but my controller doesn't so I'm not sure if problem is with IIS
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
okay hold on
It translates to
"This page is not working"
"localhost is currently unable to process this request." when I use PersonelController's url but the WeatherForecast works which automatically created with the project. When I replace my _context.SalesData.ToListAsync(); with just a simple string that I define myself page loads
and you mean this ?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
sorry needed to refresh i guess
its Opera GX
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I removed the api/ part from here
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I can try on Chrome
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah I tried doing this on a different computer it was giving me the same error now I switched to my own computer did everything all over again and same error
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
chrome looks exactly the same as far as i can tell
okay I'll try doing try catch
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
it says that it can't be converted to "Personel" class type
and I can't leave it empty either what should i put there
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
aha no worries I'm worst I don't get to judge
still
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
alright haha
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
login failed
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
its not gonna be used anywhere it's been given to me to learn how to do entityframework and how to do webapi
so it can be leaked np
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
nope
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I got a good pc but I should stick with the sql express and IIS for this project I'm instructed to use these
I could try to use docker etc when I'm done with this to learn more
So I haven't understood this part much do I give the permission from SQL express
or somewhere else
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I see
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I think I did it
hold on
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
It worked!
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
since its not gonna be used anywhere i just gave every permission to it lol
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah I'll try changing those to see which ones it need and do not give unnecesaryy ones etc. Thank you very much for your help man I tried doing this whole thing 3 times 😄
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Just one more question idk if you know but the reason for this web api is to Create an another project (.net maui) so it works on windows/android/ios etc. The person who told me to learn this IIS thing said to make it work on android you need to have web api. So all i need to do now is connect to this URL from the .net maui and get the data from there, deserialize it and it should work ?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
thats exactly what I was gonna use I was looking now lol okay I'll avoid that then I'll check out that document and maui tomorrow I'll accept this win for today haha thanks for everything again
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
/close