SignalR on hosting - virtualdirectory/signalr/hubs shows Error 404 - c#

I have a SinglaR app (empty web application without any global.asax and RouteConfig) which works well.
http://localhost:62673/signalr/hubs shows 'ASP.NET SignalR JavaScript Library v2.2.0' javascript and it is working (I use Winforms client, not the javascript one).
But when I deploy it to the webhosting (virtual directory), on the address http://myhosting.xxx/virtualdirectory/signalr/hubs I get error 404 instead.
I have this in my web.config:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
What else am I missing?
Thanx

Ok, I found it after a whole day. This directive in web.config is needed:
<add key="owin:AutomaticAppStartup" value="true"/>

Related

"Could not load type xxx" in IIS 8.5 for IHttpModule

I have created an http module in ASP.NET
namespace aellerb.App_Code
{
public class ContentParser : IHttpModule
{
...
}
}
Configured in web.config like this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="ContentParser" type="aellerb.App_Code.ContentParser"/>
</modules>
</system.webServer>
The module works and loads when run locally in IISExpress. However when I deploy it to my web host under IIS 8.5 I get:
System.Web.HttpException: Could not load type 'aellerb.App_Code.ContentParser'.
Any idea what I am missing here?
you may need to declare the assembly name
try this
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="ContentParser" type="aellerb.App_Code.ContentParser, {your_web_application_dllname_without_extention_name}"/>
</modules>
</system.webServer>
Looking through this article I found "Custom handler and module source code can be put in the App_Code folder of an application...".
So I created a folder called App_Code on the server, and copied my http module .cs file to there. It now loads and problem is solved.

500 Internal server error at PUT Web API

I have MVC Web API that have POST and PUT functions; POST function calls succeeded but PUT function call failed with:
internal server error;
Functions are identical "I use one function at a time and the other one will be commented; Just for testing purposes".
public HttpResponseMessage Put(string id)
{
HttpStatusCode statusCode = HttpStatusCode.OK;
return Request.CreateResponse<string>(statusCode, id);
}
public HttpResponseMessage Post(string id)
{
HttpStatusCode statusCode = HttpStatusCode.OK;
return Request.CreateResponse<string>(statusCode, id);
}
Edit: It works fine locally at my machine for both POST and PUT (Windows 8.1); but when i move it to another machine (Windows Server 2012 )only POST functions works.
Use POST to create resources when you do not know the resource identifier. With POST creates, it is best practice to return the status of “201 Created” and the location of the newly created resource, since its location was unknown at the time of submission. This allows the client to access the new resource later if they need to
Finally i found a solution for this issue, it seems that there is an issue in WebDav, in some cases it is not enough to remove it from your application Web.Config you should disable it from IIS by following steps from this article How to disable WEBDAV in IIS
I will update this answer when i found exactly what is the problem with WebDav that make removing it from application Web.Config not enough for windows 2012 but working fine in windows 8.1
I had the same problem. PUT and DELETE endpoints worked while I was debugging in visual studio, but not when I deployed to IIS.
I had already added this
<system.webServer>
<modules runAllManagedModulesForAllRequests="false">
<remove name="WebDAVModule" />
</modules>
</system.webServer>
in my web.config, so I wasn't thinking about the WebDav. Ebraheem's answer had me looking closer at the WebDav.
Ended up that the IIS Server had WebDav Publishing enabled in Features and Roles. So I removed it and now everything works as expected.
The remove <remove name="WebDAVModule" /> is not enough. What I found out is that you have to specifically remove it from handlers as well and also just to make sure the verbs are allowed you can set them in the security node. The following is what I set in my web.config which allowed the put and delete to work without setting anything in IIS.
<!-- After the <system.web> node -->
<system.webServer>
<handlers>
<!-- default handler settings here if any -->
<!-- Add the following to remove WebDAV handler -->
<remove name="WebDAV" />
</handlers>
<modules runAllManagedModulesForAllRequests="false">
<!-- Add the following to remove WebDAV module -->
<remove name="WebDAVModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<security>
<!-- Add the following to specifically allow the GET,POST,DELETE and PUT verbs -->
<requestFiltering>
<verbs allowUnlisted="false">
<add verb="GET" allowed="true" />
<add verb="POST" allowed="true" />
<add verb="DELETE" allowed="true" />
<add verb="PUT" allowed="true" />
</verbs>
</requestFiltering>
</security>
</system.webServer>

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.(the project does not even run locally)

This same question was posted in the site and the suggested answer was to use.
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
but adding the above mentioned line does not solve the issue.
Most likely cause
This application defines configuration in the system.web/httpHandlers
section.
And
Module ConfigurationValidationModule
Notification BeginRequest
Handler ExtensionlessUrlHandler-Integrated-4.0
Error Code 0x80070032
moreover my project does not seem to load locally as well, where as the question i mentioned earlier worked fine locally.
How do i Solve this error?
Thank you in advance. :)
Removing the following line from the web.config file fixed the issue for me.
<system.web>
<httpHandlers>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
</system.web>

Installed glimpse attempting to access glimpse.axd and receive 404 error?

It is a simple as that I installed glimpse following this page. :
http://getglimpse.com/About/QuickStart
I then attempt to navigate to http://myApp/glimpse.axd and receive 404 error not found.
As you can see in the Quickstart there is this statement. :
If you get a "Page not found" when browsing to "/glimpse.axd" check the troubleshooting section in the FAQ.
There is nothing in the FAQ regarding this. I have skimmed this website and getGlimpse.com attempting numerous other configurations and nothing is working. Any one else run into this issue and fix it?
Tried this also. :
Glimpse for MVC3 module not found after NuGet install of Glimpse.MVC3
I encountered the same problem and in my case the solution was to add the following code to Application_Start() in the MvcApplication class:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
Make sure you have the Glimpse module and handler registered in your web.config based on the web server you are using.
If you are using a site on IIS6, in IIS7.x classic pipeline mode or Visual Studio Development Server
<system.web>
<httpModules>
<add
name="Glimpse"
type="Glimpse.Core.Module, Glimpse.Core"
/>
</httpModules>
<httpHandlers>
<add
path="glimpse.axd"
verb="GET,POST"
type="Glimpse.Core.Handler, Glimpse.Core"
/>
</httpHandlers>
...
And if you are using IIS 7.x in integrated pipeline mode or IIS Express:
<system.webServer>
<modules>
<add
name="Glimpse"
type="Glimpse.Core.Module, Glimpse.Core"
preCondition="integratedMode"
/>
</modules>
<handlers>
<add
name="Glimpse"
path="glimpse.axd"
verb="GET,POST"
type="Glimpse.Core.Handler, Glimpse.Core"
preCondition="integratedMode"
/>
</handlers>
...
</system.webServer>
I had a multi-project solution and was installing it from the Package Manager Console. I found that installing it using the following command worked:
PM> Install-Package -ProjectName <MyProject> Glimpse.MVC4
Of course you need to replace <MyProject> with your own project name.
I have had a very similar problem, and none of these options helped me, but I did get it working. This is what I had to do:
I am using MVC 5, so make sure you have read the latest config for glimpse for the version you are using. I should have been using Glimpse.AspNet and not Glimpse.Core
My web config looks like this:
<handlers>
....
<remove name="Glimpse" />
<add name="Glimpse" path="glimpse.axd" verb="GET"
type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet"
preCondition="integratedMode" />
</handlers>
<modules>
....
<remove name="Glimpse" />
<add name="Glimpse"
type="Glimpse.AspNet.HttpModule, Glimpse.AspNet"
preCondition="integratedMode"/>
</modules>
I am using IIS Express, Vs2015 and for some reason my C:\Users\me\Documents\IISExpress\config\applicationhost.config got messed up, and had a special entry for Glimpse.
So I found and removed any entries with Glimpse in them (carefully, you might want to comment them out instead)
<application path="/Glimpse.axd" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="\path\to\extra\website" />
</application>
I think this may have happened from a really early version of glimpse been installed, and also something to do with the upgrade to MVC5, but not 100% sure why...
Hope this helps someone else.
In my case, the web app is not deployed in root, so the url is:
http://localhost:54026/MyApp/glimpse.axd
Very obvious, but I'll leave this answer as a reminder.
Install Glimpse.AspNet and it will fix the issue for you and also modify the web.config by adding the handler and module.

HttpModule not running with Visual Studio

I am using an HttpModule to do some URL shortening on my site. I am using Visual Studio 2008 and IIS 7, and .Net 3.5.
When the module is specified in the system.webServer element of web.config, and the site is run in IIS, it works fine. The config looks like this:
<system.webServer>
<modules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</modules>...
My module attaches to the BeginRequest event, everything works. However, I can't get it to run using the built-in VS web server (Cassini). I tried moving the module config to the system.web element in web.config, no luck. I put a breakpoint on it, nothing happens.
Any thoughts on why this would be an issue?
(I also tried the Application_BeginRequest event in global.asax. Still no luck, though I'd prefer to keep everything in web.config anyway.)
Cassini, the development web server provided with IIS uses the IIS6 module syntax, so you must duplicate the module add like so
<system.web>
<httpModules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="MinimizeModule" />
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule"
preCondition="managedHandler" />
</modules>
</system.webServer>
Note that I've also added a precondition to your IIS7 settings
If you are running on IIS 7, put the module in:
<configuration>
<system.webServer>
<modules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</modules>
</system.webServer>
</configuration>
If you are running on Cassini (Visual Studio's integrated miniature web-server), put the module in:
<configuration>
<system.web>
<httpModules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</system.web>
</configuration>
IIS will crash if you give it the Cassini location.
Cassini will crash if you give it the IIS location.
Whenever i deploy, i have to be sure not to deploy web.config. i also include the notes in web.config:
<system.web>
<!--The Cassini location to add modules (comment out for IIS)-->
<httpModules>
<!--WARNING: IIS will crash if you leave this in here.
IISBUG: IIS doesn't support system.web/httpModules,
and Cassini doesn't support system.webServer/modules
-->
<!--Comment out for IIS-->
<add name="PerformanceHttpModule" type="DummyPlaceholder.PerformanceHttpModule"/>
</httpModules>
</system.web>
<system.webServer>
<!--The IIS7 location to add modules (comment out for Cassini)
<modules runAllManagedModulesForAllRequests="true">
<!--IIS7 will crash if you present a system.web httpModules. -->
<remove name="PerformanceHttpModule" />
<add name="PerformanceHttpModule" type="DummyPlaceholder.PerformanceHttpModule"/>
</modules>
</system.webServer>
IIS's left hand doesn't know what Cassini's right hand is doing - and they both screwed it up.
Did you try also putting the module declaration in the element? When running in dev using Cassini, that's usually the place I have to put modules to get them running.

Categories

Resources