I have developped a web service using c# and Asp.net and this works fine on my local machine where I use vista and IIS7.0. I call it via Jquery using this url
http://localhost/myWebservice/vote
But when I try it on the preproduction site, I receive an 500 error from the server telling me the /vote is not good. I still can access it directly in the browser when typing ?op=vote, but I have then an error saying the formatting of my xml is not right.
Am I missing something in the configuration of the IIS 6.0?
To use routes in IIS 6 you probably need a wildcard mapping in IIS; along the same lines as this (for ASP.NET MVC, but the same concept) - although to be honest, I'd expect a 4xx for a file not found.
500 typically indicates a more serious problem - for example, the app-pool identity isn't configured correctly and can't execute as a service. Check the event log on the server for messages.
As an aside; always try to develop on something as close to the actual hosting platform as you can. For example, I run a Win2003 server in a VM for hosting IIS6. This saves a lot of unexpected surprises when you come to deploy.
Related
A couple of days ago our web app started showing a 503 error when trying to access our web app. It works fine when ZScaler is off. This is an old app running .NET MVC 5 on a Windows Server 2012 machine. No changes were made from our side when the issue started happening, so I was suspecting that the networking team had done something. However, they cannot seem to locate the issue.
When trying to access the page through Chrome, I get a HTTP 503 error, but on Firefox it shows a blank page and says that the connection is not secure. I can access the web app through the server hostname URL fine. However, when trying to use the registered domain name, it is displaying this error. I have checked the logs on the server, but it isn't showing anything specific to this error.
Does anyone know what this could be? Is there anything in IIS that I should look at specifically?
I have checked the logs on the server, but it isn't showing anything specific to this error.
An HTTP 503 error usually indicates that the server is currently not able to handle the request due to maintenance or capacity issues. It could be caused due to many factors, like a server outage, an issue with the network, or a problem with the application itself.
Here are a few things you can try to troubleshoot the issue:
Check the IIS logs, IIS logs are located in the
C:\inetpub\logs\LogFiles folder by default.
Check the event logs, event logs can be accessed through the
Event Viewer (eventvwr.msc).
Try accessing the web app using the server's IP address instead of
the registered domain name. This can help determine if the issue is
related to the domain name or the server itself.
Make sure that the application pool for the web app is running and
that the application pool identity has the necessary permissions to
access the web app's files and resources.
Check the network configuration and make sure that the server is
properly connected to the network and that there are no issues with
the network connection.
Check the web.config to make sure that it is properly
set up and that there are no issues with the web.config file.
Check the ZScaler configuration to make sure that it is not
blocking access to the web app. You may need to work with the
networking team to determine if there are any issues with the
ZScaler configuration.
I have a prototype .net web site that is on Windows 10, created using C#. I am using IIS on the same machine to deploy from Visual Studio 2017. It uses SQL Server for back-end data. The site only runs on intranet.
It deploys ok, I can see all the pages, from all three of my machines. But others cannot see anything. They get a run-time error, that does not say anything specific.
My machine was re-imaged and hence the need to redo this.
I looked at IIS log and it does not have any info. What else I can look into?
In web.config, turn off custom error mode to see detailed error message on the client:
How to set web.config file to show full error message
If it works locally and not remotely, it's likely a permissions error (accessing a resource that the client doesn't have access to), or maybe a pathing issue (you are referring somewhere to something by disk or UNC instead of URL, or to a domain that only makes sense to you, like localhost).
I have managed to create a deployment package and install it on IIS. It is not serving content correctly.
The server responds appropriately when trying to hit URLs that would not be routed to the Web API application, or when the request doesn't make sense. For instance, trying to hit a non existent url gives a 404, or making a GET request to a route that only supports POST returns 405 method not allowed with this message:
{
"Message": "The requested resource does not support http method 'GET'."
}
All other requests are giving 403 forbidden errors. To me, this indicates routing is working correctly and there is some other configuration error. I've tried both the 'bad' and 'good' solutions listed here: http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html, neither made any difference.
I noticed that the application has not created the user database tables, as it did automatically when I ran the application for the first time. I figured this may be related.
I believe IIS is correctly configured; it has .NET 4 and integrated mode for the application pool. I have confirmed that ASP.NET 4.5 is installed via the Add/Remove Windows Features dialog.
The application I am trying to host is based on: https://github.com/MikeWasson/LocalAccountsApp. I have made very minimal changes. Everything works fine locally.
Server stats:
Windows Server 2012 R2
SQL Server 2016
IIS 8.5
So, the underlying issue was I had not set up a https binding for the site. This was obscured by a few things, mainly that the endpoints were acting inconsistently. One end point was redirected by IIS or Web API to the https binding (presumably because of some setting enforcing it), while another was quite happy to serve me 403/405 errors above.
I am struggling to get similar behaviour from my dev webserver [1] and my test environment [2], and am now looking at why the dev returns HTTP 400 Bad Request with this URI?
http://localhost:1234/v1//Dy888/1/1234567815/swlocation?fv=24&sv2=3&sv3=5
(Note the two slashes after "v1".)
[1] Cassini in VS2008
[2] Win Server 2008 with IIS7
Thanks in advance!
- Niklas
PS.
I started this search with this question, where I was told that the URI aforementioned should not generate a Bad Request at all:
IIS7 NOT returning HTTP 400 for a bad request
DS.
You should not expect similar behavior between the ASP.NET Development Server that comes built-into Visual Studio and the IIS Web Server.
They are generally two different web servers with different code bases and different feature sets. Even if they should behave similar (what they definitely don't e.g. web server features like SSL, URL Rewrite Rules, etc.) never expect them to do so.
That's just another reason Microsoft stopped the development for the ASP.NET Development Server and introduced IIS Express to get your development and your production web server experience again on the same page.
So my recommendation for you is:
Stop using the ASP.NET Development Server
Start using IIS Express
Still don't expect them to behave the same!In question only a test/staging system running a real IIS instance can give you the real experience!
Hope that helps!
I have a bug where special characters (danish 'ø' in this case) are shown correctly when running locally, but wrong when the code runs on a server (I get a pipe '|'). I was trying to solve this today, but I did not have access to the server, other than updating the code files. I will limited access monday, so I can at least write intermediate results to a log file, but to be prepared I thought I'd ask for suggestions here.
Program flow:
A C# test calls my own web service via a WebRequest.
This web service calls an external web service via another web request.
When running my own web service locally I get correct results returned from the external web service.
When deploying the code to the server the external web service returns an error; it didn't find the word I was searching for. Except that I entered 'Bøssemagergade', but the word it complains about is returned as 'B|ssemagergade'. What can cause this difference? AFAIK the server runs with the exact same regional settings as my local machine.
I'm sure this is common stuff, but I haven't been doing web services before (I do feel at home with C#/.NET though, and know about encodings etc.).
Thanks!
You need to check your data at every stage in the process. Make sure you understand which encoding you're using (try to avoid using Encoding.Default) and verify the binary data going across the wire with something like WireShark.
See my debugging unicode problems article for further information.