Accessing OData service gives 404 "Resource not found error" - wcf

This could be a entirely hosting service related problem but I'll post it here in case it is a more common problem.
I'm running a OData service on my ASP.NET MVC 2 site which works fine on my laptop IIS but when I deploy it to my site at Winhost I get 404 Resource not found error when trying to access the .svc-file.
Earlier I had 2 different authentications on so I got the "System.InvalidOperationException: IIS specified authentication schemes 'Basic, Anonymous'...." error so I know that at that point the handler was trying to start the service.
After fixing that, I got the "Resource not found error".
The service is in /Services folder but it does not seem to matter. No matter where I put it it always gives me the 404 error. All the binaries from my local sites bin folder are in my remote sites bin folder.
Everything else on the site seems to be working fine.
If anyone has a solution to this, help would be much appreciated.

Finally got this figured out. Since my site is an ASP.NET MVC 2 site I need to ignore the route to the service. Otherwise ASP.NET will start looking for a controller for that URI.
So I added routes.IgnoreRoute("Services/ServiceFilename.svc/{*pathInfo}"); to my global.asax.cs and voilá problem solved.
Although I don't quite understand why the service works on my laptops IIS 7 without the ignored route.

Related

Login to manager of piranhacms hosted in docker behind nginx on ubuntu (aspnet core 6)

Does anyone has experience hosting piranha on ubuntu in a docker container behind nginx?
The frontend is fine, everything works smooth. But the manager is not working for me. It has something to do with the login. First i saw error 502 after login (failed login was working with correct error message, so the post itself is working). I changed the login not to do the local redirect but returning the page. No error message, so i guess the login data was fine, but somehow i am still not logged in.
The only cookie i see is the antoforgery. Someone has an idea, the is no error message in the logs.
The problem was, that aspnet core identity created a cookie larger then nginx accept in proxy communication.
I increase the buffers, but this did not work for me. There are a lot of article about it, but nothing worked.
So i decided to reduce the header sent. The application configuration has been changed to manage the identity in a different way. More information in memory but smaller cookie.

IIS return 404 error but the files are exist

I have a website that implemented with .net core 2.1 and angular js.
I published this website on windows server that worked with IIS.
The problem is that, sometimes response of http requests for some files or request (the ajax request that called) is 404 error and sometimes it works correctly and I am sure that file is exists because if the user that faced with error, refresh the page, it will load correctly !
I attached a photos that compare same requests.
After many days I have this problem yet. I enabled IIS logs and attach one of xml log file here.

Dots in URL causes 404 with Web API call in .net core

I have a similar requirement which is mentioned in the link Dots in URL causes 404 with ASP.NET mvc and IIS . Our requirement is, we also do have URLs with dots in the path. For example I may have a URL such as www.example.com/people/michael.phelps (This example is taken from above link)
URLs with the dot generate a 404. If we pass without the dot, then everything works. If we add the dot I get a 404 error.
The above link provide solution for earlier versions of .net where we can have webconfig files. But we are using .net core to build web API application. Dotnet core does not support webconfig files. Can someone please suggest how can we arrive at the solution by using .net core.
Late answer but we had a similar case:
We had a url looking like https:/domain.com/somepath/smoething.cd
This returned a 404 from the IIS. Adding a / at the end of the url behind the .cd fixed the issue.
Strange but notable: not all.something return a 404, .com at the end of the path for example works

Published Aurelia Application Virtual Directory 404 Error

I have a .NETCORE application being an Aurelia Framework app. I also have a .NETCORE Web API. To publish these to the server I use the CMD .net publish --framework netcoreapp1.0.
I host this site on the Default Web Site which is pointing to the Aurelia app. Inside of this site I have another application being the web api. The site and API run great. I recently tried to create a Virtual Directory to server my images. Any time I try to navigate to //mywebserver/images I get nothing but 404 errors. I can play with the permissions and have it give me a 401.2 unauthorized, but any other time I just get a 404 error.
I can create a dummy website pointing to the IIS wwwroot folder, create a virtual directory and it works like it should, so I would think it has something to do with these published apps.
For anyone who stumbles across this question. Shortly after posting I came across some information on a site. http://www.jauernig-it.de/asp-net-coreiis-serving-content-from-a-file-share/
Matthias discusses that with .netcore Virtual Directories are basically dead and you should start using app.UseFileServer in your startup.cs file.
Thank you
I seems that the '404' Http return code is the default error code in published .netCore apps (I had this return with a sql server connection problem).
I think it is not related to Aurelia. use app.UseFileServer to handle your images.

How to prevent .net 4 handling 404 on IIS6

I have what seems to be the exact opposite of everyone else's problem! I am hosting a .Net4 site on IIS6, and while I want IIS to handle 404 errors (where I can configure it to send the error to an aspx page), it seems like .Net4 gets in the way by issuing a 302 redirect for the default page (which doesn't exist either) before I can get on with handling the 404 properly.
Basically, if I goto http://mysite/testProduct, .net4 issues a 302 for http://mysite/testProduct/default.aspx, which then goes on and gets handled by my error handling setup in IIS6 which is to redirect 404s to /404.aspx, which detects the product name, looks up an ID and does a Server.Transfer.
How can I stop .Net getting in the way? It's doubling the overhead of a page request, and will cause my products to get indexed with /default.aspx after them which I do not want.
AHA, Ben
EDIT: if I turn off CustomErrors in the web.config, .Net is still handling the error and not letting it pass to IIS at all - I see a 404 error page that is generated by .Net. So I get a 302 then a 404...!
Found the problem in the end - this was for an implementation of nopCommerce, which comes with UrlReWriter installed out of the box - it was this component that was causing the behaviour noted above...