How to Host Service svc on Local IIS? - asp.net

I am hosting site on my local IIS, The service (*.svc) file i put in MyProjectFolder/Service directory . I am getting following error. I am calling service from ajax call direct through service path. "neo.Mysite.Net/Prent.svc"
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension
configuration. If the page is a script, add a handler. If the file
should be downloaded, add a MIME map
Most likely causes:
•The directory or file specified does not exist on the Web server.
•The URL contains a typographical error.
•A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
•Create the content on the Web server.
•Review the browser URL.
•Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here

U could refer this short and simple blog post http://weblogs.asp.net/stevewellens/calling-wcf-services-with-jquery-stripped-down

Related

blazor client application Cross-Origin Request Blocked: openid-configuration error

Dotnet core 3.1 blazorwasm template app is giving the below error while accessing from network or after hosting it on a linux server. It seems the published app is always looking for local host ip for redirection at certain places.
the errors appeared on the firefox console is given bellow
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:5000/.well-known/openid-configuration. (Reason: CORS request did not succeed).
how to configure and publish it to avoid routing to localhost.
This can be reproduced by simply taking the code
https://github.com/dotnet-presentations/blazor-workshop
after running it from visual studio try to access it from a remote client (another machine) will give error while navigating from login and registration links.
Try adding the following CORS middleware configuration to the web API's service's Startup.Configure method and see if that works:
app.UseCors(policy => policy.WithOrigins("http://localhost:5000", "https://localhost:5001")
.AllowAnyMethod()
.WithHeaders(HeaderNames.ContentType));
You need to add this to this file if you are using the code mentioned in your question.
Doc and sample project can be found here.

ResponseRedirect fails when source url path contains http://

As part of an imageprocessing module I accept urls in the following format in order to process and cache externally hosted images.
http://localhost:56639/remote.axd/http://ipcache.blob.core.windows.net/source/IMG_0671.JPG?width=400&filter=comic
After processing the file, if I use Response.Redirect(url, false) to redirect the server to a valid external cache url, the server returns a 404 error response citing the StaticFileHandler as the source of the error.
If the file comes from a local source something like.
http://localhost:56639/IMG_0671.JPG?width=400&filter=comic
The server redirects to the external url without issue. Can someone explain why and provide a solution?
Note: remote.axd does nothing other than allow the local server to intercept the external url. I use the .axd extension as it isn't mapped to route by default in MVC.
I've noticed that when looking at the request path the http:// segment is replaced with http:/. I don't know whether that causes an issue.
So the reference to StaticFileHandler is the clue.
Following the actions of my HttpModule the handler is attempting to process the request. When a locally cached file is used this finds the file and all is ok. Since I am redirecting to a remote url and have a remote source the handler is finding nothing and throwing a 404 exception.
Further processing of the request has to be halted following a rewrite using the following method.
HttpApplication.CompleteRequest

500 Internal Server Error - Any Upload via Wordpress Admin Panel

I am running a Wordpress website on Windows Server 2012 on VPS. I am receiving 500 Internal Server Error when I try to upload anything such as theme, media, plugin via adming panel of wordpress site. I am wondering why is this happenning.
What I could find so far is:
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP-php
Error Code 0x80004005
Requested URL
Physical Path
Logon Method Anonymous
Logon User Anonymous
More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »
Microsoft Knowledge Base Articles:
294807
Ok, I have found the solution after a day of research. In my case the error was the PHP Support. I changed the PHP support in Plesk from Fast CGI to CGI then boom. It worked. Hope it will help you some how.

ASP.NET file rebasing with a reverse proxy

We have a site hosted on a domain that is provided by a reverse proxy from a 3rd party. The proxy provides sends the url www.example.com/nl/test/ to our server where the site is hosted on.
The site itself uses frameworks like Telerik UI for ASP.NET Ajax and the Ajax Control Toolkit.
By default when the site is loaded all the scriptresources/themes files/images are being written with the path "/scriptresource.axd" "/image.gif" the reverse proxy from the 3rd party picks this up and tries to redirect files to wwww.example.com/defaulthomepage/.
So by default ASP.NET writes paths to the domain root which is not something we want in this scenario, it should point to /nl/test/ instead.
In order to prevent default method of writing file paths the URL Rewrite extension for IIS was installed.
There are no a couple of rules in URL Rewriting which succesfully rewrite all the files to /nl/test/file.whatever but every time an Ajax request is made the following error occurs
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Is there a way to rebase the default file path of an ASP.NET site through code? We have already tried the base html tag.

jQuery form plugin - uploading file to a different domain

I have a asp.net website which is supposed to upload files to a handler from a different application / domain. I'm using jQuery Form plugin. When trying to make an example on the same domain (uploading to the same domain) this setup works with success. When trying to upload file with from siteA to siteB I see in firebug that response from handler has been returned (in the Network tab) and is valid, however, the code never enters the 'success' handler, instead giving me such errors in the firebug console:
[jquery.form] Server abort: Error: Permission denied to access property 'document' (Error) log:
[jquery.form] cannot access response document: Error: Permission denied to access property 'document'
[jquery.form] aborting upload... aborted
In chrome it is:
Unsafe JavaScript attempt to access frame with URL http://domainB/handler.ashx from frame with URL domainA. Domains, protocols and ports must match.
Now, I am aware of the fact that there are some policies about ajax calls between domains, but it seems that jquery form plugin simply tries to access some url that is forbidden.
Does anyone have a workaround for it? Any solution please!:)
UPDATE:
I ended up hacking jquery.form so it doesn't throw cross-site exception and since I don't need actual result of upload - it works for me!
Check this and yes, this is a same-origin policy. There are ways to work this around using flash, iframes, jsonp etc but this will require editing a plugin.

Resources