Why IIS web site not working when adding Site name - c#

I created an Asp.net website with the 4.5 framework, it works fine in Visual studio with sitename (http://localhost:8080/Mywebsite/Default.aspx) but it is not at the IIS level after deployment.
This is how it is deployed:
Deployment picture
When we try to consult the application with the URL http://localhost:8080/Mywebsite/Default.aspx, we receive an error message.
An error has occurred in the error page: http://localhost:8080/Mywebsite/Default.aspx: The file 'Mywebsite/Default.aspx' does not exist.
Thank you for your help

I have found the solution for the one who will encounter the same situation:
after creating the website in IIS, we create a folder with the name Mywebsite1 under the directory C:\initpub\Mywebsite1 to have at the end C:\initpub\Mywebsite1\Mywebsite1, after we return to IIS and we create an application under the website initially created and we give it a name like Mywebsite1 for my case.
In this way, we can access our website with the url http://localhost:8080/Mywebsite/Default.aspx
Deployment Image

Related

Error in the path of an IIS server in Asp.net

I have a small web application in Asp.net.
Everything works fine on my computer. When I publish on my IIS server I get this error:
Exception details: System.Runtime.InteropServices.ExternalException: Generic error in GDI +.
The error is generated by this line:
bitmap.Save(cPathImage + "Immagini/tempimage.bmp");
cPathImage is HttpContext.Current.Server.MapPath("/");
This is the interesting part of the error stack on the IIS server:
Sicaweb._Default.CreateImage() in D:\DOTNET2019\Sicaweb\Default.aspx.cs:184
The folder D:\DOTNET2019\Sicaweb is the one present on my pc, it doesn't exist on the server and I don't understand where it comes from.
If I check the cPathImage variable on the server it is C:\inetpub\sica\
I don't really understand what happens.
I solved the problem myself, it was caused by Visual Studio which restores the permissions of the folders with each publication.
Thanks to those who gave -1 for no reason.

Why can't my WebAPI service call find part of the path to a folder via IIS?

I have .NET Core WebAPI 2.1 services. I created a structure in my deployment folder like below. (I'm using IIS.) I want to access MyVariables.json from all services. But, it gave this error:
Could not find a part of the path 'C:\wwwroot\MyProject\Shared\MyVariables.json'.
But that folder and path do exist. I'm trying by this code from my C# service.
using (StreamReader file =File.OpenText(#"../Shared/MyVariables.json"))
{
}
What can be the reason of this?
My publish folder design
-wwwroot
-MyProject
+Service1
+Service2
+Service3
+Service4
-Shared
MyVariables.json
IIS runs with an identity that is configured in the App pool.
Directory access rights must be given to the identity used to run the App pool.
Start inetmgr.exe to configure IIS,find App Pool identity and then configure access in file explorer.
Reference: https://learn.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities

Rotativa crashes on service fabric node in Azure

I have a project that needs to collect several data and put it in a single pdf, to do so I used Rotativa wrapper. It works fine on my local service fabric cluster and Im able to generate the pdf using ViewAsPdf and then getting the byte array to attach it in an email. The problem comes when I deployed the project in Azure (service fabric cluster) and Im getting this error:
at Rotativa.AspNetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe)\r\n at Rotativa.AspNetCore.WkhtmltopdfDriver.ConvertHtml(String wkhtmltopdfPath, String switches, String html)\r\n at Rotativa.AspNetCore.ViewAsPdf.<CallTheDriver>d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---
Things that Ive tried:
Installed Visual C++ Redistributable Packages for Visual Studio 2013 and 2015 in x64 and x86 versions in the service fabric node (where the project is being deployed)
Moved the Rotativa folder from wwwroot to the root path of the project and set the path in RotativaConfiguration.Setup() method
Copied msvcp120.dll and msvcr120.dll to the Rotativa folder
Installed wkhtmltopdf.exe in the service fabric node
I installed Rotativa.AspNetCore 1.0.6 nuget package
I use ViewAsPdf to render the razor view and I call BuildFile method to get the byte array
If I ran the wkhtmltopdf.exe in the command line in the service fabric node I get: "The application was unable to start correctly(0xc000007b) Click ok to close the application"
The service fabric node is a Windows machine. The project is built with aspnet core 2.0
Any help will be appreciated. Thanks!
I assume is a missing dependency issue.
Based on the scenario and message you provided The application was unable to start correctly(0xc000007b) there are other related problems:
The application was unable to start correctly (0xc000007b) and Error : the application was unable to start correctly
The other issue might be lack of permissions to run or access specific dependencies.
I would suggest you try:
running as administrator first via command line.
Check firewall or network\website permissions
Use dependency walker and check the dependencies it loads\fail and verify if they are installed on the server.
As a workaround you could create a container to run this. It would save you the trouble of going into the nodes to install stuff, which limits your scale out & fail-over options.
There are some people who got it working.

Get complete stack trace from error for asp.net core app hosted in IIS

I got recently a .net core app from someone else and when I try host this app in my local IIS I see a error message with no much information.
What I want to do is get the correct error message but when I change the keys"stdoutLogEnabled" and "stdoutLogFile" in the web.config (generated after publish the site from VS2017), nothing haapens.
What can i do to see more details about the error?
I tried to do others things force to my web project run on a specific runtime and install the specific bundle in IIS.. for example
2.0.7
and install this bundle:
https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.0.7-windows-hosting-bundle-installer
but still I have the error.. i think a better idea instead to install all bundle what I can get should be get the details stack trace of the error....
Any help is appreciated.

Server Error i / Application

I have in my production environment a compiled version and I create a new aspx but when I tried to call the web page is showing a message error (see "Problem Production Environment" below).
How can I find a way to call the new web page in my production environment?, knowing that I can not compile the web application from dev environment (see "Details" below).
Please, your collaboration to find a solution.
Thanks
Details.
1. I want to say that I can not compile and deploy the version from dev environment because this version is different vs production environment.
In dev environment, the new web page works. I setup in the controller file and from the Menu to call the web page.
//new request - Controller.cs public ActionResult summary() { return View(); }
Menu.ascx file
...
customer/summary" title=" Summary"> Summary
Problem Production Environment.
Server Error in '/' Application. The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.
Requested URL: /customer/summary
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.7.2558.0

Categories