AJAX enabled WCF service for cascading dropdown method 404 error - ajax

I am new to WCF issues and I'm trying to populate an control by using a wcf service . I have used 'Ajax-Enabled WCF' template ( VS 2010) for creating my service. there is no error while on Asp.net development server but when put on IIS [Method 404 Error] appears in dropdown . I tried to access the WCF services directly like (https://sitename/webservice/test.svc) it shows the documentation page.
I have searched for hours to find a solution but no use. I will be thankful if anyone can help me out
Thanks

Can you connect to your IIS hosted service via WcfTestClient (see under Tools)? Also check the endpoint address in App.config on your client...If that does not work, could you post client's App.config and Web.config from Service's IIS?

I had similar issue, where it worked on dev server, but not Integration (got 404, service is not defined error).
The issue was the .svc file type was not mapped in IIS, which fixed the issue.

Related

Can a Blazor API project share the same localhost endpoint with the client?

As far as I can tell, the model for creating a Blazor client application is to have one project for the client and another for the server. The Microsoft template shows an async call to get data, but it's just a download of a static JSON file. Any real application would need to call an API.
So I have a separate API project for this. But that project has a different localhost endpoint for debugging, and this is causing a CORS nightmare for me. My call from client to server isn't really cross-site, except for this debugging problem, so I don't want to do a ton of work figuring out CORS.
How can I get the Blazor client and web api server to run off the same localhost (or alias) domain, so that the client can make same site requests?
Yes.
When you create a new Blazor Web Assembly app there is a tick box for hosting it in ASP.NET.
If you tick that checkbox then you'll get a server that both serves the client page (via _Host.cshtml) and also responds to web api calls.

How can I access my server webapi project from by client javascript project in Visual Studio

I have a VS 2012 solution with a web api server project and a javascript-html client project. I can test my web api with Fiddler. I can test from another test project using HttpClient, but because I have the server and the client running on separate ports in IIS Express, I have some kind of CORS issue because when I try to make an ajax call from the client I get a 405 method not allowed error.
I have added the suggested custom header entries to my web.config and applicationhost.config files that should allow cross origin access.
There must be some simple solution to this that everyone uses, but it seems to escape me.
I found the answer here. I had to add the nuget package for system.web.http.cors and the web api took care of everything. Didn't need to touch my client side javascript.

Running MVC3 application on server results in 403.14 response

I am trying to get an MVC3 application working on a Windows Server 2008 R2 box. The server is running IIS 7.5. The application is setup with anonymous authentication and a v4.0 framework application pool. I have given IUSR and IIS_IUSRS access to the directory until I switch to using a service account.
I have tried the following:
Registered ASP.NET 4 with IIS (%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir)
I have installed MVC3 on the server from http://www.asp.net/mvc/mvc3.
I am still receiving an HTTP 403.14 response: "HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory."
If I throw in a dummy index.html file, the page gets served. It seems to me like a module isn't intercepting the request to point the request to the home controller.
Answer: While MartinHN's answer did resolve the issue, it would result in a performance hit when serving static files. Thanks to his answer I started doing some searching and found that there is a IIS7 hotfix available which will allow ASP.NET 4 applications to handle extensionless URLs without running all modules for each request. The hotfix is available here: http://support.microsoft.com/kb/980368. After installing this hotfix my application was serving content as expected, without the Web.config change.
Might be one of the following...
Check your web.config for the line:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
...
</system.webServer>
And make sure that the application pool is set to the Integrated Pipiline.
You can also try to reset the Handler Mappings in IIS. Click the site --> Handler Mappings --> Revert to parent (link should be on the right sidebar).

Configuring WCF for Web Browser Access

I'm fairly new to WCF but am technically competent.
I am having trouble getting WCF to play nicely. I currently have a WSHttpBinding set up to a service and it is working when using the WCFTestClient supplied with VS2008. What I would like to do is have the service accessible within the browser.
I currently return a JSON response from my service but am unable, as of yet, to access the data via. a URL. I have seen lots of internet tutorials where they seem to be accessing data a bit like this (note the bolded section):
http://localhost/Service.svc/MethodName?param1=value1&param2=value2
If I try and do that I get a 404 - I am guessing it is looking for a literal file but don't know how to fix it.
Any help you can give would be great, thanks!
You can't do that with WSHttpBinding... you need to expose an endpoint using the WebHttpBinding and have your contract correctly specify the right uri template in the [WebGet] attribute. Here are some pointers to get you started:
Rest in WCF
WebHttpBinding example
WebHttpBinding and JSON

How to call Java web service (JAX-WS) from AJAX?

I am developing java web services (JAX-WS) to insert data into mysql DB and retrieve it. This web service has two methods i.e. fetchFromDB and insertIntoDB. Services seems to be running fine when I test them using netbeans IDE.
Address: /CalculatorWSService
WSDL: /CalculatorWSService?wsdl
but when I try to access it using AJAX's xmlHttpRequest object by providing url http://localhost:8080/CalculatorApp/CalculatorWSService. It is not able to access it. I have developed C# web services and It has been so easy to access them with a url but java web services don't seem to follow that.
My question is
What url to use to access the web service operations in AJAX? (Do I need to use '?wsdl' in the url?
Is there a javascript ajax library to easily access JAX-WS web services?
Apache Axis web services are a better choice over JAX-WS?
Please help me, Thanks, Jay
I was having the same problem of yours, couldn't invoke a Jax-ws web service from Javascript, but i've found a way to do this.
The Url to use can be your same (EndPointAddress) "http://localhost:8080/CalculatorApp/CalculatorWSService"
but when you create the XMLHttpRequest object from javascript you have to:
* Use the POST method to open the URL , i tried with GET but it didn't work for me.
* Set the SOAPAction Request Header to the one in your wsdl, even if its empty "".
* Be very careful with the request body to send, the soap Envelope must be correct.
hope this can help you!.
Bye.
Paul Manjarres.
From the client's perspective, I wasn't expecting significant differences between Axis and JAX-WS. Everything the client needs should be in the WSDL.
One thing that sometimes happens is that the URL used when developing a WebService references the develpoment host and port (and maybe even the ContextRoot) When deployed to a particular server any of those could be changed. Ideally a new WSDL could be created with new "binding" information.
My first step would be to point a browser directly at the Web Service you want to invoke. In my environments that returns a nice "Hi this is a Web Service" kind of message. If you get 401 not found errors then you just need to study exactly how the web service was deployed. Was a different port or context root specified?

Resources