Run WCF methods from a browser

Yes, you can call those methods in a browser, if your service is configured properly, though you have the URL syntax wrong. To call WCF methods from a browser, you need to do two things: Use [WebGet] and [WebInvoke] attributes on your methods, which you have done. Use a webHttpBinding for the endpoint of your … Read more

WCF using computer name instead of domain name when viewing MyService.svc?wsdl

WCF 4.0 has solved this issue in some instances with a new config option that use Request Headers: <behaviors> <serviceBehaviors> <behavior name=”AutoVaultUploadBehavior”> <useRequestHeadersForMetadataAddress> <defaultPorts> <add scheme=”https” port=”443″ /> </defaultPorts> </useRequestHeadersForMetadataAddress>

WCF service returning 404 on method requests

The first thing I do whenever I hit a 404 with a newly-developed WCF Web Service is checking the handler mapping required to interpret this type of call, because it’s often the cause of the issue. There are several ways to work around the problem, many of which require a manual execution of the ServiceModelReg.exe … Read more

Cannot start IIS Express

For me this problem was due to a misconfiguration in the project which manifested itself in IISExpress’ applicationHost.config file. I had both the http and https ports setup as the same. <site name=”{projectname}” id=”3″> <application path=”https://stackoverflow.com/” applicationPool=”Clr4IntegratedAppPool”> <virtualDirectory path=”https://stackoverflow.com/” physicalPath=”{myPath}” /> </application> <bindings> <binding protocol=”https” bindingInformation=”*:57287:localhost” /> <binding protocol=”http” bindingInformation=”*:57287:localhost” /> </bindings> </site> To solve … Read more

access HttpContext.Current from WCF Web Service

You can get access to HttpContext.Current by enabling AspNetCompatibility, preferably via configuration: <configuration> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled=”true”/> </system.serviceModel> </configuration> That in turn allows you to get access to the current user: HttpContext.Current.User – which is what you’re after, right? You can even enforce AspNetCompatibility by decorating your service class with an additional attribute: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] … Read more

WCF support in Mono

The most comprehensive, concise place to look is probably here: http://go-mono.com/status/ For example, look at System.ServiceModel, etc. for WCF status. You can look class by class at the features that you need. We’re using Mono’s WCF stack to host some basic http services on Linux and a few things don’t work (such as serving up … Read more

Visual Studio does not generate app.config content when “add service reference”

When adding the service reference try clicking on the ‘Advanced…’ button and then uncheck the ‘Reuse types in referenced assemblies’ checkbox. I found this out when I had created a simple project to test a third party service which all worked fine. Attempting to add the same reference to the main project resulted in the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)