can't browse to a .cs file in a WCF service - wcf

I'm running my WCF service program. This error has occurred; how can it be solved?
Server Error in '/' Application.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cs' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /IService1.cs
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

You aren't deploying your service correctly, you should be using .asmx/.svc files and dlls. You probably need to walk through a MSDN WCF Walkthrough
Here is another good MSDN document explaining the Hosting of WCF Services

Related

consuming standard SOAP Web Service using vb.net

I have consumed several wsdl services successfully, but am stuck now with this web service.
Am implementing Hotelston webservice which state :Hotelston.com API is a standard SOAP Web Service (WS) available at URL
http://www.hotelston.com/ws/HotelService?wsdl
I cant access the direct code of the webservice after i added the it as a reference in my application.
Please see the following MSDN articles for the exact details on how I added and used these web service references but still cant access it from the direct code.
How to: Add and Remove Web References
How to: Call a Web Service
For full API documentation of wsdl file through the link.
If you show all files in the project and expand the service reference out, Reference.cs is empty. This is likely because there are namespace errors in HotelService.wsdl ("ax23", specifically) that is causing the t4 template to fail to generate the service code. Bottom line, it's their fault, not yours.

How do I access a workflow service in silverlight?

I have one worflow service named GetDataWorkflowService.xamlx that I want to use in Silverlight.
When I add a service reference to my application, it gives a message 'This Operation is not supported for the relative URI.' It still adds the reference, however.
When I use the referece:
Servicelient proxy=new ServiceClient();
proxy.GetDataCompleted += (o, a) => Debug.WriteLine("Result is " + a.Result);
proxy.GetDataAsync(123);
I get the following error:
An error occurred while trying to make a request to URI 'http://localhost:1234/GetDataWorkflowService.xamlx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
I don't understand what's happening.
A few things:
What happens if you use the WCF Test Client to call GetData()? Do you get an error or does that work just fine. If you get an error here concentrate on the server parts.
What happens if you set a service reference from a console application and call your workflow service. Same error or does that work?
Is the workflow service hosted in the same web site as the Silverlight client? If not do you have the cross domain policy files setup correctly.
Assuming the WCF Test Client works. Open up fiddler and compare the request from your Silverlight client with that from the WCF Test Client. What is different?
Enable tracing on the server to see if there are any exceptions or warnings that might provide more insight to what is wrong.
Check your startup project to be sure you are starting a web project and not the Silverlight project. For more details see Troubleshooting Workflow Services / Silverlight on my blog

IIS6 cannot handle WCF json response

I wonder if you could help me with this. I have a .NET 3.5 WCF RESTful service that returns json. Service works fine on my local machine but when I deploy it on IIS6 I get this error: The server encountered an error processing the request. See server logs for more details.
The WebInvoke method is GET and when I try to access the service method in browser on the IIS6 machine I get a prompt that asks me to download a file (with the response of the GET request).
I'm really baffled by this as when I choose to download and open the file I see the json that is suppossed to be returned....Strange behavior by IIS.
Any clues on this?
The answer was rather trivial...
Because my wcf operation was returning a List of objects for some reason IIS insists in that case the BodyStyle to be WebMessageBodyStyle.Wrapped , unlike local development service where the response was returned correctly both with Bare and Wrapped formats.
Thanks for all suggestions guys.

Using a WCF Service Library from Silverlight

I've added a WCF Service Library to a Silverlight project. But when I try calling a method on the service I get a CommunicationException complaining about accessing a service in a cross-domain way.
I've tried adding both a crossdomain.xml and clientaccesspolicy.xml to the service library project, but it doesn't help.
Any idea what I'm doing wrong?
You mention that the policy files are going into the service library, have you checked they get placed into the correct place within the website?
Try running up fiddler to see what the web site is actually returning when the service is called.
Copy CrossDomain.xml and clientpolicy.xml files in C:\Inetpub\wwwroot path. :)

WCF, Silverlight: clientaccesspolicy.xml not being found

I"m trying to connect my Silverlight application to a WCF service that I'm hosting myself. I've created a clientaccesspolicy.xml file, and placed it in the service host project's root, but when I try to hit the service, my http sniffer says it can't be found. Specifically the file it's looking for is http://localhost:8080/clientaccesspolicy.xml.
I'm running the server and the silverlight app in debug mode in Visual Studio 2010. Do I need to put the file somewhere else?
The clientaccesspolicy.xml file must be in the root of the domain where the service is hosted. You may already have it there but the virtual path of the web site or web application from the property page will need to be changed to "/"
See this page
for more information.
I did not understand how you're hosting your WCF service?
Is it hosted in a asp.net application or a windows host (self-hosting)? If the latter is the case, you may have to implement a clientaccesspolicy service that provides the content of the clientaccesspolicy.xml file on request.
For example like this.