Error on adding a service reference to use web-centric WCF service? - wcf

I am trying to follow a textbook learning how to create a web-sentric WCF service project. I created the service, and see the corresponding folder under Default Web Site on IIS. I can even browse the folder (localhost/EmployeeService/) and see the contents in the browser. Now I want to make a client, i.e. a simple Console application. When I am trying to add a Service Reference, after I enter the address, I get an error:
There was an error downloading 'http://localhost/EmployeeService/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/EmployeeService/'.
The remote server returned an unexpected response: (405) Method Not Allowed.
The remote server returned an error: (405) Method Not Allowed.
Could you please explain? I saw some questions about the same error, but could not find a solution for myself.
Thanks.

In order to invoke the service, you must point at the service file. Otherwise the web server doesn't know what you're trying to do.
Add the .svc file to your URL to do that, so http://localhost/EmployeeService/YourService.svc.
You can also have it fileless, see How can I host a WCF service without an SVC file in IIS.

Related

Blazor WASM Deploy to IIS Object reference not set to an instance of an object

I developed a Balzor WASM and it works on local machine with bellow structure :
But when I deploy to IIS it show me this error :
{"error":"Object reference not set to an instance of an object."}
It is very strange that has no any http 500 error in debug mode but when I hosted on IIS it shows me this error.
There is no any additional information in page or event viewer!
Another thing is I host both release and debug files on IIS. I shows me this message again!
Anyone can help me?
The error seems to be json and is strange that is on your index page of the WASM client.
The only possibility I can think is a request from your index.hrml to your backend but there's a problem of configuration.
Check your endpoint base address in your appsettings.json in your wwwroot of the client app.
Try to use postman (or another client like it) to test calls to your backend when hosted on IIS.

invoke web service with authentication headers in ode bpel

I'm using eclipse bpel designer and trying to invoke a external service which requires authentication headers to be passed.
Here is what I have done
1. Created a headers.endpoint file with the following content
*alias.sample_ns="http://sample.com"
sample_ns.serviceName.portName.ode.http.default-headers.username=system
sample_ns.serviceName.portName.ode.http.default-headers.password=admin*
Placed it in ..\webapps\ode\WEB-INF\processes\$process folder
When I invoke the service I'm getting the following error
"Error sending message (mex={PartnerRoleMex#hqejbhcnphrckf492s9n9b [PID {http://createReservation}CreateReservation-1541] calling org.apache.ode.bpel.epr.WSAEndpoint#1e1f4b8.saveRecord(...) Status ASYNC}): Transport error: 401 Error: Unautho".
I think I need to add header information when invoking the service in BPEL process as well. But couldn't find the way to do it. How can it be done, if this is actually what I'm missing? Or is there something else to be done?
Thanks in advance
Note: HTTP Auth information cannot be set in the *.endpoint files.
For invoking HTTP Service
Testcase will show you how to do it
https://github.com/apache/ode/tree/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties
Add message part in WSDL as shown here
https://github.com/apache/ode/blob/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl#L66
Assign credentials in Process
https://github.com/apache/ode/blob/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel#L73
For invoking Soap Service
http://ode.apache.org/http-authentication.html

Setting IIS to play mpeg dash

I trying to setup a website to play mpeg dash(.mpd) file using IIS 6. I have created a website in IIS and trying to access it via the below web address.
http://xx.xxx.xx.xx/MPEG-DASH/scifi_trailer
But its giving me the below error:
HTTP Error 404.0 - Not Found The resource you are looking for has been
removed, had its name changed, or is temporarily unavailable. Detailed
Error Information Module IIS Web Core Notification MapRequestHandler
Handler StaticFile Error Code 0x80070002 Requested
URL http://xx.xxx.xx.xx:80/MPEG-DASH/scifi_trailer Physical
Path C:\inetpub\wwwroot\MPEG-DASH\scifi_trailer Logon Method Anonymous
Logon User Anonymous
Any help on why i'm facing this issue?
Thanks,
Johm
You need to add in the right mime type into IIS.
See https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/cd72c0dc-c5b8-42e4-96c2-b3c656f99ead.mspx?mfr=true
You can find the correct details for the mime type from
http://www.sitepoint.com/web-foundations/mime-types-complete-list/

The remote server returned an error : 400 badrequest in WCF

In our project, we are calling the .svc file directly from asp.net web page and I receive the error "The remoter server returned an error:(400) bad request.
Our project architecture is, we are using .svc file in our web application and the .cs file for the svc in writter in another class library project. From aspx, we are calling the WCF service directly without adding reference or anything. I cannot change the concept, because it is our standard. I'm able to add service reference and call those methods, but I wanted to call the method directly from .svc url.
I'm pissed off for 2 days and could not resolve the error. We are using HttpWebRequest to get the response from the service. Basically, the service will take Data Transfer Object(DTO) as input and returns the same(DTO) as output with only one value.
Check the following code:
HttpStatusCode statusCode = HttpHelper.PostXmlRequestValue(requestXMLInput,
string.Format("http://{0}/{1}/MySample.svc/webhttp/MyMethodName",
Request.ServerVariable["HTTP_HOST"], Request.ApplicationPath);
The same code works in one machine but not in the other. I have checked the configuration and everything is same, but still I receive the same error.
When I use the .svc url in my machine, it works, but gives a message "Method not allowed". When I checked the same url in the working machine, I got the same message.. I believe there is some simple thing I'm missing out. I couldn't find, as I'm new to WCF.
When using HttpWebRequest the "Method not allowed" error is for example that you are sending a Http GET, when the service expects a Http POST.
HttpWebRequest is a REST based configuration, this limits the complexity of the DTO's that you can send.

WCF Service - The resource cannot be found

I am deployed my published the WCF web service to my server and when i am tryihg to
access it its giving me following error????
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /API/Errors/GeneralError.aspx
It was an application pool issue, on recycling the application pool the issue got resolved.
I would say it has to do with the handlers setup in IIS...
read this http://bloggingabout.net/blogs/jpsmit/archive/2007/01/17/wcf-http-404-when-hosted-in-iis.aspx