I receive the following error when I attempt to make a web request to a recently deployed remote server that's shared and running IIS:
SEC7120: Origin http://localhost:8000 not found in
Access-Control-Allow-Origin header.
HTTP404: NOT FOUND - The server has not found anything matching the
requested URI (Uniform Resource Identifier). (XHR)GET -
http://mywebsite/someservice/somevalue
All of this works fine when I run the web server on my local machine.
Any suggestions?
You'll need to set up CORS handling on the server so that browsers will allow cross-origin javascript requests. See Enabling Cross-Origin Requests (CORS) for instructions on how to do this for .Net Core apps.
Related
I have built a RESTful API in which I set the http_response_code() in some cases. I was using the XAMPP APACHE web server while developing the API on localhost.
The problem is that, now that I have deployed the API on our EC2 containerized DEV instance, which runs an nginx web server, all of my http_response_code() calls are not working and the API is always returning a "200 OK" status code, which is not wanted in cases like an error should be thrown when for example a user already exists in the system and a registration with the same email is forbidden.
Therefore, is there an equivalent of http_response_code() for nginx web servers?
HTTP Error 502.3 - Bad Gateway
There was a connection error while trying to route the request.
Most likely causes:
•The CGI application did not return a valid set of HTTP errors.
•A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.
Things you can try:
•Use DebugDiag to troubleshoot the CGI application.
•Determine if a proxy or gateway is responsible for this error.
Detailed Error Information:
Module
AspNetCoreModule
Notification
ExecuteRequestHandler
Handler
aspNetCore
Error Code
0x8007000d
Requested URL
http://localhost:15536/
Physical Path
C:\Users\HenryP\Desktop\NopCommerce_4.2.0\src\Presentation\Nop.Web
Logon Method
Anonymous
Login User
Anonymous
More Information:
This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway was unable to send the request to a parent gateway. You may need to get a network trace or contact the proxy server administrator if it is not a CGI problem.
View more information »
It seems this is not CGI issue. Newest nopCommerce version run on .net core version and require Full Trust. And my experience used Godaddy in the past that they didn't support Full Trust, so you can't install nopCommerce on their platform. You better contact their support team or you can ask this issue on nopCommerce forum. But, it seeems that nopCommerce can't run well on Godaddy platform. If you use nopCommerce, I recommend you can check Asphostportal.
According to your description, this is a generic error for when IIS can't find the specified .NET Core components ,and doesn't know where to forward requests.So i suggest you to check once you select asp.net or asp.net core while creating your site
I am getting HTTP 400 error in our application.The error is coming frequently but some times we are able to access application without 400.
There is one SSO application in which our application's link is added so same session details we are getting in our application.But when i login to the other application from same domain, and refresh the first one, I get HTTP 400 error. other applications cookies are also getting in our application.
I am using apache 2.2 on web server and tomcat 7 on app server.
I have tried increasing LimitRequestFieldSize on web server but it didn't work and current LimitRequestFieldSize is 65535.
Technology stack :- backend :- Java,Documentum
apache 2.2 web server tomcat 7 on app server
Kindly check and provide solution it will be helpful.
Thanks in advance.
I have two separate projects
MVC Web App
MVC Web API
I have published both on my IIS 7.5
My Web App is hosted on 7172 port
and Web API is hosted on 7171 port
Strangely iam not able to call jquery.ajax() from my web app (7172) to web api (7171) port. It gives me 405 Method not found error code.
But if i write the same jquery.ajax() in my web api project (7171) and call web api method then it work fine and returns data.
I want to call web api from my web app.
Any suggestion would be appreciated.
Thanks in advance.
This has to do with the Same Origin Policy. By default, you can't execute an AJAX call to another domain (both on name, port and protocol).
If you want to enable this you should use Cross-origin resource sharing (CORS). CORS can be used with Web API by installing a (prerelase) NuGet package: Microsoft ASP.NET Web API Cross-Origin Support
This package allows you to configure which domains can call your service. You can find a walk trough here Enabling Cross-Origin Requests in ASP.NET Web API. In essence it comes down to adding attributes to your controllers like this:
[EnableCors(origins: "http://myclient.azurewebsites.net", headers: "*", methods: "*")]
You're running into the same-origin/cross-domain security policy. The port used is part of the origin calculation. A bit of Javascript loaded from (say) localhost:80 cannot make an AJAX request to localhost:8080, because the port numbers don't match. The 405 error you're getting is almost certainly coming from your Web App, not the API - check the server logs for the app, and you'll see the ajax hit in there.
If I have a WCF SOAP (C#) based web service running in my local IIS - and I make an ASP.net website, again running in my local IIS - will the javascript making HTTP request calls from my webpage be successful? Or do the same origin policy rules come into play here?
It depends on how your sites are configured in IIS. Check out this wikipedia article on same origin policy.
Let's say your WCF SOAP service is running on http://localhost/service/GetStuff.svc and your ASP.NET site is running on http://localhost/mysite/Default.aspx. According to the table in the same origin article, the call should succeed, since your server host is the same in both cases (localhost) and differ only on the directory being referenced.
But, if your WCF SOAP service is running on http://localhost:8080/service/GetStuff.svc and your ASP.NET site is running on http://localhost/mysite/Default.aspx (default port of 80), then the call will fail since the server host differs in the port being accessed.
The three things to consider are host, protocol (http or https) and port. According to the article, not all browsers enforce port.
I hope this helps. Good luck!
BTW, does your application work?