How to deploy Dart server to IIS - dart

I want to deploy a basic dart server that uses shelf to an IIS server.
I ran the command dart compile exe and tried to place the executable along with the web.config file in a file system. I set up the workpool with the settings I need. I have a DNS ready which is mywebsite.reu.po and set up the proper bindings for it. It gives me a 503 error something about handlers. The server host name is localhost and the port is whatever APSNET_PORT is. If nothing is found in that port, then it grabs port 4000.
Here is what I have in my web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\server.exe" />
</system.webServer>
</configuration>

So I figured out the solution for this. I had to change the identifier for the pool since there are multiple admin accounts for the IIS. However, only one account has the ability to do hosting. Go to the pool, advance settings, and change the identifier with the right admin credentials.

Related

IIS Application The requested page cannot be accessed because the related configuration data for the page is invalid

I am running a .Net 6.0 Web API application that works fine on my dev machine. I am trying to deploy to IIS running on a windows Server
the web.config is
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Zimpla.WebApi.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 0214ca6f-0fd4-4643-92b7-4202aaa1024a-->
It has a separate application for the directory and I get the following error
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Every single page I go to in IIS Manager says "there was an error performing this operation" - filename c:\inetpub\wwwroot\logistics\web.config Error:
IIS and users have read and execute access to the whole directory. What am I missing?
Have you installed the .NetCore Runtime before hosting your .Net 6.0 Web application? If not, please install it. Restart your site and again try to check for the issue.
This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can't identify the XML elements of the modules that are not installed. For example, IIS URL Rewrite module.
You could fix the error with the steps below.
Delete the malformed XML element from the ApplicationHost.config or Web.config file.
Check the unidentified XML elements, and then install the relevant IIS modules.
If you have the HRESULT code(something like 0x8007000d) then you could refer to the document below to check the error cause/ solution for that specific HRESULT code.
Ref: HTTP Error 500.19 - internal server error when you open an IIS Webpage

How do you set the root page in an AppHarbor ASP.NET MVC website?

I'm publishing an ASP.NET Web Application (this is the default application with VS2013) and it publishes just fine. However when I visit my application
http://someapp.apphb.com
I get the "Welcome to nginx" page. However http://someapp.apphb.com/Home works.
Is there a setting on AppHarbor that I need to change, or do I need to make a change to my WebApp?
You can set default document in Web config file
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

Running MVC 6 Beta 8 application on IIS

I'm trying to publish my MVC 6 Beta 8 app. I was able to successfully publish it to Azure, but when I try to publish it to ASPHostPortal, I'm getting 500 error.
So I tried to publish the app to a local IIS and also failed. First, I figured out that I need to install HttpPlatformHandler (otherwise IIS was not able to load web.config). But even after that, I'm getting 502.3 error.
HTTP Error 502.3 - Bad Gateway
There was a connection error while trying to route the request.
Also in Event Log I can see an error 1000 from HttpPlatformHandler with no description. But it says "Process '0' failed to start. Port = 13679, Error Code = '-2147024894'."
stdout.log is created but is empty.
Here is my web.config:
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="true" stdoutLogFile="stdout.log" startupTimeLimit="3600"></httpPlatform>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
Where do I go from here?
Thanks to Daniel's comment and https://github.com/aspnet/Hosting/issues/364 I figured out that HttpPlatformHandler 1.0 that I installed via Web Platform Installer does not support relative paths. So I installed HttpPlatformHandler 1.2 and now it works!!
x86 version: http://go.microsoft.com/fwlink/?LinkId=690722
x64 version: http://go.microsoft.com/fwlink/?LinkId=690721
The alternative solution (also worked for me) was to use full paths in httpPlatform configuration instead of relative paths.

500 - Internal server error after deployment [duplicate]

I am trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this:
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
After fiddling around with the web.config, I got:
The page cannot be displayed because an internal server error has occurred.
How can I see the actual issue behind this server error?
First, you need to enable and see detailed errors of your web messages, because this is a general message without giving information on what's really happening for security reasons.
With the detailed error, you can locate the real issue here.
Also, if you can run the browser on the server, you get details on the error, because the server recognizes that you are local and shows it to you. Or if you can read the log of the server using the Event Viewer, you also see the details of your error.
###On IIS 6
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
###On IIS 7
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
Note: You can avoid the Debug=true. You only need to close the custom errors for a while and get the detailed error page.
This can help: How to enable the detailed error messages (from IIS).
I was pulling my hair out over this issue. Making sure the following entry was in the root web.config file fixed it for me:
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
Remember that you have to add this to the existing XML elements, if they're already there. You can't just add at the end of the file, because you can't have multiple copies of any element.
For me, the following code in the web.config was the culprit. When I removed it, the web site worked fine.
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
I finally solved this "500 Internal server" error when deploying the ASP.NET MVC 3.0 application on godaddy.ocm shared hosting.
somehow there were discrepancies on the version of DLL files referenced and version mentioned in file web.config.
I tried all the options mentioned in various forum. Nothing helped, although everyone suggested the same kind of fix, but somehow it didn't work in my scenario. Finally after banging my head for two days.
I decided to delete all DLL file reference and delete web.cofig (make a local copy) from the project and let the application throw the error and then add the DLL files one by one making copy to local=true.
After all the DLL files were added, I created a new ASP.NET MVC application and copied the web.config of new application to my actual application.
So my actual application now has a new web.config, and then I copied the connectionstring and other references from the local copy of web.config that I saved.
I just compiled the application and published to a local folder
and FTP the published folder to goDaddy.
It worked and finally my problem was solved.
In my case, I put a mistake in my web.config file. The application key somehow was put under the <appSettings> tag. But I wonder why it doesn't display a configuration error. The error 500 is too generic for investigating the problem.
My first attempt to publish and then run a very simple site serving only HTML produced "The page cannot be displayed because an internal server error has occurred."
The problem: I had the site set to .NET 3.5 in Visual Studio (right click web site project -> Property Pages -> Build), but had the Web Site in Azure configured as .NET 4.0. Oops! I changed it to 3.5 in Azure, and it worked.
In addition to the other suggestions, make sure to change the existingResponse attribute of the httpErrors node to Auto from Replace, or to remove that property entirely.
<httpErrors existingResponse="Replace" />
^^^^^^^ not going to work with this here
Server Error 500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed. Goddady. Hosting - Web - Economy - Windows Plesk
In my case, I replace this code:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
Then change framework 3.5 to framework 4. It shows my detailed error. I delete code in:
<httpModules></httpModules>
It solved my problem.
IIS also reports status code 500 without any event log hints if there are insufficient permissions on the physical home directory (i.e. IIS_IUSRS has no access).
For IIS 10 There is a extra step to do other than changing the customErrors=Off to show the error content.
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough" errorMode="Detailed"/>
</system.webServer>
Raul answered the question in this link Turn off IIS8 custom errors by Raul
Probably your web.config file is wrong or is missing some tag. I solved my problem using the correct config tags for .NET 4.
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<authentication mode="None"/>
</system.web>
I realized the permissions for the files and folders in your server also matter. I uploaded my files from a linux operating system and usually the permissions are limited for read and write. So when uploaded, the permission are still same as in the local machine.
I had the same error and i just changed the permissions for the folder i had uploaded and the error was gone.
Hope it helps someone.
500 Internal Error
Windows Hosting Error
Godaddy Hosting issue
I have been facing the same issue, but now my issue has been resolved. Always use in this hosting this it works.
I will also recommend you all to do whatever changes you are looking to make in your web.config file. Please do it one by one and test the same on the live domain so that you can find the exact problem or the features that your hosting provider does not allow you to use.
<?xml version="1.0"?>
<configuration>
<system.web>
<trust level="Medium"/>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
<sessionState mode="InProc" cookieless="false" timeout="90" />
<authentication mode="Forms">
<forms loginUrl="default.aspx"
defaultUrl="default.aspx"
protection="All"
cookieless="UseCookies"
slidingExpiration="false"
timeout="30"
name="aeon.corpusjuris.in" />
</authentication>
<customErrors
mode="Off"
defaultRedirect="errorpage.aspx">
<error statusCode="403" redirect="errorpage.aspx"/>
<error statusCode="404" redirect="errorpage.aspx"/>
</customErrors>
<!-- <httpModules>
<add name="HTTPCaching" type="HTTPCaching"/>
</httpModules>
-->
</system.web>
<runtime>
<performanceScenario value="HighDensityWebHosting" />
</runtime>
<system.webServer>
<!-- <modules runAllManagedModulesForAllRequests="true">
<add name="HTTPCaching" type="HTTPCaching"/>
</modules>
-->
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
</files>
</defaultDocument>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<staticContent>
<clientCache cacheControlCustom="public"
cacheControlMaxAge="60:00:00"
cacheControlMode="UseMaxAge" />
</staticContent>
</system.webServer>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="90000000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
If you're using a custom HttpHandler (i.e., implementing IHttpModule), make sure you're inspecting calls to its Error method.
You could have your handler throw the actual HttpExceptions (which have a useful Message property) during local debugging like this:
public void Error(object sender, EventArgs e)
{
if (!HttpContext.Current.Request.IsLocal)
return;
var ex = ((HttpApplication)sender).Server.GetLastError();
if (ex.GetType() == typeof(HttpException))
throw ex;
}
Also make sure to inspect the Exception's InnerException.
500 internal server error can arise due to several reasons. First reason might be that web.config file is not properly created, means you have missed some tag in the web.config file. Secondly this error can be due to some code problem. To check which component of the web application is causing this error you can check Application setting in web.config file. The detail of solving and tracing 500 internal server error with diagram is given here:
Make sure your account uses IIS 7. For more information, see Customizing IIS Settings on Your Windows Hosting Account.
Follow the instructions in Changing Pipeline Mode on Your Windows IIS 7 Hosting Account. Select Integrated Pipeline Mode.
In your Project References section, set Copy Local to True for the following assemblies:
System.Web.Abstractions
System.Web.Helpers
System.Web.Routing
System.Web.Mvc
System.Web.WebPages
Add the following assemblies to your project, and then set Copy Local to True:
Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
Publish your application.
Sometimes, the reason might be one of your .dll assemblies is not registered correctly on the server.
For example, you can successfully run a C# Excel web application on your local machine with Office installed, while getting the 500 error on server deployment, because there is no Office suite installed on the server, and thus you get the server error.
For those who have this possibility (VPS hosting not web hosting):
Connect to your hosting server via Remote Desktop. Open Web Browser from your remote desktop and you will see the detail description of the error.
You don't need to modify web.config or expose any details to anybody else.
If you are using IIS 8.5 it may be that you need to change the ApplicationPool ID setting from ApplicationPoolId to NetworkService
Right click the Application Pool in question, click on "Advanced Settings" and then scroll down to ID - it will probably be set to ApplicationPoolIdentity. Click the button (..) and select NetworkService from the dropdown list instead.
Also make sure that if it is a .NET 2.0 application that you are not referencing the 4.0 framework in your App Pool.
Before changing the web.config file, I would check that the .NET Framework version that you are using is exactly (I mean it, 4.5 != 4.5.2) the same compared to your GoDaddy settings (ASP.Net settings in your Plesk panel). That should automatically change your web.config file to the correct framework.
Also notice that for now (January '16), GoDaddy works with ASP.Net 3.5 and 4.5.2. To use 4.5.2 with Visual Studio it has to be 2012 or newer, and if not 2015, you must download and install the .NET Framework 4.5.2 Developer Package.
If still not working, then yes, your next step should be enabling detailed error reporting so you can debug it.
I recently got into same problem, the disk space was full on the server. Clearing some space has resolved the issue.
Try compiling in Debug mode (in Visual Studio). If you are in Release mode, a lot of URL Rewrite errors will not be available.
Image shows the Debug selection combobox in Visual Studio

Log4Net works on Dev machine, fails when deployed to shared host (using same db/connstring)

I have log4net configured and working fine on my local machine, however when I deploy to my host (godaddy) it fails silently. I am using the same database/config file on my dev machine, and on the host. My log4net reference is set to copy local, and the log4net.dll, .pdb, and .xml exist in the bin on the host. This is an asp.net mvc app.
Edit: No exceptions are thrown, and the application runs as expected (minus the logging)
This is running on SQL Server 2005
The webhost is IIS 7
salient details of my config are:
<root>
<level value="DEBUG" />
<appender-ref ref="AdoNetAppender" />
</root>
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Anybody have any ideas on things to check?
In my experience, log4net usually swallows any internal errors, simply resulting in log statements that do not produce any results.
What you may want to try is enable log4net's internal logging. You can do this by adding the following to your appSettings section:
<add key="log4net.Internal.Debug" value="true" />
This sets the property LogLog.InternalDebugging to true. log4net will now log to the standard output and error streams and to configured trace listeners.
You can use the following configuration to capture any messages logged to tracing:
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\TextWriterOutput.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
All messages logged by log4net internally will appear in TextWriterOutput.log. If you get a SecurityException when you add the trace listener to your configuration, then very probably the apppool identity does not have sufficient rights to create a file at the specified location (in the example: c:\). Try another location or give the apppool identity sufficient rights.
I've just been able to resolve this problem by downloading and using the latest build of log4net (revision 1072765) from SVN repository http://svn.apache.org/viewvc/logging/log4net/trunk/
Apparently this problem has been fixed long time ago but who knows when log4net 1.2.11 is going to be released.

Resources