Reputation: 460
I have an ASPNet core application that run correctly on IIS Express with Visual Studio.
I've tried to deploy this application on IIS Server 8.5 (With file folder). If I access to the root URI (/), my page appears correctly (Status 200). But if I try to access to other URI (ex: /Meetings), I get a 404 errors.
Another things, I have tried to change the identity of the application pool to administrator and it works. But I know that it's not the best practice and I can't find why it's not working with the app pool identity.
Below some configuration, ask me if you want specific file:
web.config :
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Access logs :
2018-07-18 13:14:08 ::1 GET /Meetings - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/67.0.3396.99+Safari/537.36 - 404 0 0 1422
2018-07-18 13:22:54 ::1 GET / - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/67.0.3396.99+Safari/537.36 - 200 0 0 1841
I have also tried to change the permission to the folder, but not working.
If someone already had this problem, I'm ready to try different solutions.
Thanks,
EDIT :
Detail log of the 404 error here : https://paste.ee/p/4PBzY
EDIT 2 :
I have found this information in the windows events, but I have a connection string and my SQL Server is congured with local account.
Upvotes: 1
Views: 10733
Reputation: 460
Ok, I've finally found where was the problem.
After look at the event viewer, I saw that application try to connect to my SQL Server with the ApplicationPoolIdentity, as can you see on the screen below (sorry for the french screen)
So, I have just add this user into SQL Server with permissions on my database and configure like Mohsin Mehmood advises me (see other answer), and now it works !
Upvotes: 1
Reputation: 4236
Ensure you have the performed the following steps:
No Managed code
IIS AppPool\{AppPoolName}
must have read permissions on the published website folder. Change the identity of your application pool to ApplicationPoolIdentity. For application pool identity there will be user account with name IIS AppPool\{Applicaiton Pool name}
e.g. for DefaultAppPool the user account is IIS AppPool\DefaultAppPool
so you can allow read/write access to your to Applicaiton Pool user on published application folderUpvotes: 2