Rectangle 27 8

It's because you don't have your host headers set. This seems to be an extremely common problem, I run into it all the time. There's no configuration for the uris that it generates, it looks up the right address by examining the host header of the site. Even if it's in a virtual directory, you need to go to the parent, in your case, default directory, and add a host header.

I had the same problem and it was fixed with this solution, but I thought it only effected https hostings. Maybe not. I added the host header using the adsutil.vbs script on the IIS server. It forces the 443 port to have a specific host name rather than the default.

web services - WCF WebService / IIS Hosting & Configuration Issue Behi...

wcf web-services iis .net-3.5 configuration
Rectangle 27 35

ASMX Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

Second, ASMX web services are not flexible. However, WCF Services are flexible. If you make a new version of the service then you need to just expose a new end. Therefore, services are agile and which is a very practical approach looking at the current business trends.

We develop WCF as contracts, interface, operations, and data contracts. As the developer we are more focused on the business logic services and need not worry about channel stack. WCF is a unified programming API for any kind of services so we create the service and use configuration information to set up the communication mechanism like HTTP/TCP/MSMQ etc

Maybe it's just me, but paragraphs #2 and #3 stand out as marketing BS.

@Net Experts u said " If you make a new version of the service then you need to just expose a new end" what are u trying to say ?

endpoint
<endpoint address="http://api.microsofttranslator.com/V1/soap.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_LanguageService1" contract="TranslatorService.LanguageService" name="BasicHttpBinding_LanguageService3" />

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 34

ASMX Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

Second, ASMX web services are not flexible. However, WCF Services are flexible. If you make a new version of the service then you need to just expose a new end. Therefore, services are agile and which is a very practical approach looking at the current business trends.

We develop WCF as contracts, interface, operations, and data contracts. As the developer we are more focused on the business logic services and need not worry about channel stack. WCF is a unified programming API for any kind of services so we create the service and use configuration information to set up the communication mechanism like HTTP/TCP/MSMQ etc

Maybe it's just me, but paragraphs #2 and #3 stand out as marketing BS.

@Net Experts u said " If you make a new version of the service then you need to just expose a new end" what are u trying to say ?

endpoint
<endpoint address="http://api.microsofttranslator.com/V1/soap.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_LanguageService1" contract="TranslatorService.LanguageService" name="BasicHttpBinding_LanguageService3" />

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 21

This is a very old question, but I do not feel that the benefits of ASMX have been fairly portrayed. While not terribly flexible, ASMX web services are very simple to use and understand. While WCF is more flexible, it is also more complex to stand up and configure.

ASMX web services are ready to stand up and add as a webservice reference as soon as you add the file. (assuming your project builds)

For the simple development workflow of create webservice -> run webservice -> add webservice reference, an ASMX webservice has very little that can go wrong, not much that you can misconfigure, and that is it's strength.

In response to those that assert that WCF replaces ASMX, I would reply that WCF would need to add a streamlined K.I.S.S. configuration mode in order to completely replace ASMX.

Example web.config for an ASMX webservice:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings />
  <system.web>
    <compilation targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
</configuration>

I don't think WCF needs more configuration for the work that can be done using asmx webservices , and you can as well add a reference in your client side for the WCF service , WCF is way more powerful than asmx , it can do what asmx does and it will be as simple as asmx

@Coder1409 well it's certainly more configuration, because some things need to be configured. Binding, discoverability, etc. Not necessary in asmx. Service contracts, operation contracts, data contracts, data members. Not necessary in asmx. Of course these things are why wcf is superior and more powerful, but to deny that it adds complexity just isn't being honest. It's reaching to say that there are no downsides.

Andrew, you should try creating a simple "hello, world" WCF service in .NET 4.0 or 4.5. There is almost no configuration. Configuration was changed in 4.0 so that the default generated config file does not configure the default values, and there are default sets of values for the different bindings. So, if you create a basicHttpBinding service, you will find almost nothing in the config file.

The first (second,third...) time i created a wcf it took me ages to figure out the config required. "Why do i need to do that?" i kept asking myself. "Why bother with something so complex?". asmx just worked instantly. So saying that it's just as simple just isn't true. One day i will fully understand and change my view - until that day GRRRR!!!

@tomjm Again, try it with a modern version of Visual Studio and .NET. Among other things, the configuration system has changed to default more settings. In particular, you'll hardly need to do more than specify the URL in order to get a simple web service, http only, with no features.

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 19

This is a very old question, but I do not feel that the benefits of ASMX have been fairly portrayed. While not terribly flexible, ASMX web services are very simple to use and understand. While WCF is more flexible, it is also more complex to stand up and configure.

ASMX web services are ready to stand up and add as a webservice reference as soon as you add the file. (assuming your project builds)

For the simple development workflow of create webservice -> run webservice -> add webservice reference, an ASMX webservice has very little that can go wrong, not much that you can misconfigure, and that is it's strength.

In response to those that assert that WCF replaces ASMX, I would reply that WCF would need to add a streamlined K.I.S.S. configuration mode in order to completely replace ASMX.

Example web.config for an ASMX webservice:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings />
  <system.web>
    <compilation targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
</configuration>

I don't think WCF needs more configuration for the work that can be done using asmx webservices , and you can as well add a reference in your client side for the WCF service , WCF is way more powerful than asmx , it can do what asmx does and it will be as simple as asmx

@Coder1409 well it's certainly more configuration, because some things need to be configured. Binding, discoverability, etc. Not necessary in asmx. Service contracts, operation contracts, data contracts, data members. Not necessary in asmx. Of course these things are why wcf is superior and more powerful, but to deny that it adds complexity just isn't being honest. It's reaching to say that there are no downsides.

Andrew, you should try creating a simple "hello, world" WCF service in .NET 4.0 or 4.5. There is almost no configuration. Configuration was changed in 4.0 so that the default generated config file does not configure the default values, and there are default sets of values for the different bindings. So, if you create a basicHttpBinding service, you will find almost nothing in the config file.

The first (second,third...) time i created a wcf it took me ages to figure out the config required. "Why do i need to do that?" i kept asking myself. "Why bother with something so complex?". asmx just worked instantly. So saying that it's just as simple just isn't true. One day i will fully understand and change my view - until that day GRRRR!!!

@tomjm Again, try it with a modern version of Visual Studio and .NET. Among other things, the configuration system has changed to default more settings. In particular, you'll hardly need to do more than specify the URL in order to get a simple web service, http only, with no features.

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 41

There seems to be a shortage of examples about how to write a WCF client for a JSON REST service. Everybody seems to use WCF for implementing the service but hardly ever for writing a client. So here's a rather complete example of the service (implementing a GET and a POST request) and the client.

[ServiceContract]
public interface IService1
{
    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare,
        UriTemplate = "/getcar/{id}")]
    Car GetCar(string id);

    [OperationContract]
    [WebInvoke(RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare,
        UriTemplate = "/updatecar/{id}")]
    Car UpdateCar(string id, Car car);
}
[DataContract]
public class Car
{
    [DataMember]
    public int ID { get; set; }

    [DataMember]
    public string Make { get; set; }
}
public class Service1 : IService1
{
    public Car GetCar(string id)
    {
        return new Car { ID = int.Parse(id), Make = "Porsche" };
    }

    public Car UpdateCar(string f, Car car)
    {
        return car;
    }
}
<%@ ServiceHost Language="C#" Service="JSONService.Service1"
    CodeBehind="Service1.svc.cs"
    Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

And now the client. It reuses the interface IService1 and the class Car. In addition, the following code and configuration is required.

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webby">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>
      <endpoint address="http://localhost:57211/Service1.svc" name="Service1" binding="webHttpBinding" contract="JSONService.IService1" behaviorConfiguration="webby"/>
    </client>
  </system.serviceModel>
</configuration>
public class Service1Client : ClientBase<IService1>, IService1
{
    public Car GetCar(string id)
    {
        return base.Channel.GetCar(id);
    }


    public Car UpdateCar(string id, Car car)
    {
        return base.Channel.UpdateCar(id, car);
    }
}


class Program
{
    static void Main(string[] args)
    {
        Service1Client client = new Service1Client();
        Car car = client.GetCar("1");
        car.Make = "Ferrari";
        car = client.UpdateCar("1", car);
    }
}

It is soooo true that client side implementation example are very rare on internet. It helped me solve my problem.

I have asked another question about accessing the HTTP status code in WCF client. Please can you see that and throw some light? stackoverflow.com/q/4677052/23671

I'm curious. What is the point of hiding the REST service behind a RPC-based client proxy. Why not just use SOAP? By using WCF on the client like this, IMHO you have lost all the benefits that REST could bring.

This example is just a by-product of some experimenting when I was writing a WFC client for an already existing REST service using mainly JSON (implemented in Java). That service looks rather different and is almost exclusively read-only. And it has proven to be well adapted for it's purpose: to deliver data with the chosen degree of detail, in a compact format and in a single request. The clients are mobile phones with a limited bandwidth and often signification round-trip time. Fortunately, the service was not SOAP (too complex, too verbose). And the RPC-style proxies are just easy to use...

You do realize that its not REST though, right? RPC over HTTP can be valuable, but it will not realize the benefits that a REST architecture brings.

c# - Client configuration to consume WCF JSON web service - Stack Over...

c# .net wcf web-services json
Rectangle 27 6

WCF provides a lot of functionality, but at the cost of crazy-mad configuration setup. Crazy mad. It involves defining an "ABC", Address, Binding, Contract. I always tell people "with WCF: its the configuration, not the code". There are just ~so many options for configuring it.

If you need to push/pull small amounts of data to "clients" (browser, android, iphone), then WebApi is the best bet.

One feature, WebApi will give you xml OR json via how the request is setup (in the 'header').

With WCF, you have to "code up" either/or/both for json and xml and it isn't super trivial. Aka, you have to put attributes on the Service-Methods (the "Contract" of the ABC) to say "this method will send back xml" or "this method will send back json".

Your WebApi layer will provides services. This usually means providing json data or consuming json data. And MS has taken care of the "plumbing" for you, so on the services side, this happens auto-magically.

I've coded both since 2005 (well, WCF in 2005 and following, and then later with WebApi).

So unless you have a very concrete reason to use WCF, I would use WebApi.

As far as an ORM, that happens completely on the "server side", so you can pick whichever one you want. I would pick Poco/Code-First/Entity-Framework OR NHibernate.

Here is a little explanation of the auto-magic wire up...where you are not hand-parsing json on the SERVER side.

and here

Outside of my opinions here, here is a Microsoft comparison article :

and the quote:

c# - WCF vs WEb api vs Web services for new ecommerce website - Stack ...

c# android asp.net wcf asp.net-web-api
Rectangle 27 5

WCF provides a lot of functionality, but at the cost of crazy-mad configuration setup. Crazy mad. It involves defining an "ABC", Address, Binding, Contract. I always tell people "with WCF: its the configuration, not the code". There are just ~so many options for configuring it.

If you need to push/pull small amounts of data to "clients" (browser, android, iphone), then WebApi is the best bet.

One feature, WebApi will give you xml OR json via how the request is setup (in the 'header').

With WCF, you have to "code up" either/or/both for json and xml and it isn't super trivial. Aka, you have to put attributes on the Service-Methods (the "Contract" of the ABC) to say "this method will send back xml" or "this method will send back json".

Your WebApi layer will provides services. This usually means providing json data or consuming json data. And MS has taken care of the "plumbing" for you, so on the services side, this happens auto-magically.

I've coded both since 2005 (well, WCF in 2005 and following, and then later with WebApi).

So unless you have a very concrete reason to use WCF, I would use WebApi.

As far as an ORM, that happens completely on the "server side", so you can pick whichever one you want. I would pick Poco/Code-First/Entity-Framework OR NHibernate.

Here is a little explanation of the auto-magic wire up...where you are not hand-parsing json on the SERVER side.

and here

Outside of my opinions here, here is a Microsoft comparison article :

and the quote:

c# - WCF vs WEb api vs Web services for new ecommerce website - Stack ...

c# android asp.net wcf asp.net-web-api
Rectangle 27 109

There are currently other major differences between WebApi and WCF Data Services, which no one ever seems to mention. I wish MS would come out with a good article comparing the two.

I've been following OData for a while and also WebApi. I've always found a few major distinctions.

First, I'm not sure what your boss means by "MS is backing WebApi", as to mean they aren't backing OData?? IMO, they are backing both and currently there is some minimal overlap. Windows Azure Data Market exposes their Data using OData, Azure Table Storage uses OData, SharePoint 2010 allows OData Queries over it's Data, and other Products from MS are also supporting it, such as Excel PowerPivot. It's a very powerful Query framework when it comes to relational Data. And because it's RESTful, any language, framework, device, etc can integrate with it.

Here is what I like about OData + WCF Data Services:

OData + WCF Data Services has finally allowed Client Applications to be more "expressive" when querying Data over the Web. Before, we always had to use ASMX or WCF to build rigid Web APIs which get unwieldly and require constant changes whenever a UI wants something slightly different. The Client Application could only specify parameters to dictate what criteria to return. Or do like I did and "Serialize" LINQ Expressions and pass those as the Parameters and re-hydrate into Expressions<Func<T,bool>> on the Server. Its decent. Got the job done, but I want to use LINQ on the Client and have it translated over the Web using REST, which is exactly what OData allows and I don't want to use my own "hack" of a solution.

It's like exposing "TRANSACT SQL" without the need of a DB Connection String. Simply provide a Url and whoala! Start querying. Of course, both WebApi and WCF Data Services support Authentication/Authorization, so you can control access, append additional "Where" statements based on roles or other data configuration. I'd rather do this in my Web Api Layer than in SQL (like building Views or Stored Procs). And now that Applications can build queries themselves, you'll see Ad-Hoc and BI Reporting tools starting to leverage OData and allow Users to define their own results. Not relying on Static Reports where they have minimal control.

When developing in Silverlight, Windows 8 Metro, or ASP.NET (MVC, WebForms, etc), you can simply add a "Service Reference" in Visual Studio to the WCF Data Service and quickly start using LINQ to query Data AND you get a "Data Context" on the Client, which means it tracks changes and allows you to "Submit" your changes atomically back to the Server. This very similiar to RIA Services for Silverlight. I would have used WCF Data Services instead of RIA Services, but at the time, it did not support DataAnnotations or Actions, but now it does :) WCF Data Services has another advantage over RIA Services, which is the ability to perform "Projections" from the Client. This can help with performance, incase I don't want to return all Properties from an Entity. Having a "Data Context" on the Client is great when dealing with Line-Of-Business Apps.

So, WCF Data Services is great if you have Data with relationships, especially if you are using SQL Server and Entity Framework. You'll quickly be able to expose Queryable Data + Actions (calls to invoke operations, i.e. workflows, background processes) over REST with very little Code. WCF Data Services was just updated. New release launched. Check out all the new functionality.

The downside to WCF Data Services is the "control" you loose over the HTTP Stack. I found the biggest flaw was in the IQueryable<T> Methods which return Collections. Unlike RIA Services AND WebApi, you DON'T have full access to develop the logic in the IQueryable Method. In RIA Services and WebApi, you can write whatever code you want as long as you return IQueryable<T>. In WCF Data Services, you ONLY get access to append a "Where" Statement using Expression<Func<T,bool>> interceptor Methods. I found this disappointing. Our current application uses RIA Services and I find we really need the ability to control the IQueryable logic. I hope I'm wrong on this and I'm just missing something

  • I like the control over Http Request/Response

As of now (to my understanding), there is no "Data Context" support on Client (i.e. Silverlight, ASP.NET Server-Side Code, etc), because WebApi isn't really about Entity Data Models like WCF Data Services/OData is. It can expose Collections of Model Objects using IQueryable/IEnumerable, but there are no Primary Key/Foreign Key "Navigation Properties" (i.e. customer.Invoices) to use once the Entities are loaded on the Client, because there is no "Data Context" which loads them asynchronously (or in one call using $expand), and manages the changes. You have no code-generated "representation" of your Entity Data Model on the Client, like you do in RIA Services or WCF Data Services. I'm not saying you can't/don't have Models in the Client that represent your Data, but you have manually populate the Data and manage which "invoices" are to be set with each "customer" once they are retrieved over the Web. This can get tricky, specially with all the Async stuff going on. You don't know which calls will come back first. This may be hard to explain here, but just read about the "Data Context" stuff in RIA Services or WCF Data Services. So when dealing with Line of Business Apps, this is major issue for me. This is mainly based on productivity and maintainability. You can obsolulately build Apps without a Data Context. It just makes things easier, specially in Silverlight, WPF, and now Windows 8 Metro. Having relational Entities loaded into memory asynchronously and having Two-Binding is really nice to have.

Having said that, does this mean some day WebApi can support a "Data Context" on the Client? I think it could. Also, with more tooling, a Visual Studio Project could generate all your CRUD Methods based on a Database Schema (or Entity Framework).

Also, I know I'm only mentioning .NET to .NET Frameworks when it comes to working with WCF Data Services or WebApi, but I'm very aware that HTML/JS is also a major player. I was just mentioning the benefits I've found when dealing with a Silverlight UI, or ASP.NET Server-Side Code, etc. I believe with the advent of "IndexedDB" in HTML5/JavaScript that having a "Data Context" and a LINQ framework in JavaScript could also become available, making the ability of querying OData Services even easier from JavaScript (you can use DataJS today with OData). Plus, using KnockoutJS to support MVVM and Binding in HTML/JS as well, will make it a breeze :)

I'm currently researching which platform to use. I'd be happy using either, but I tend to lean towards OData based on the fact that my next Application is primarly about Analytics (read-only) and I want a rich expressive RESTful Api. I believe OData + WCF Data Services gives me that because WebApi only supports $take, $skip, $filter, $orderby over Collections. It does NOT support Projections, Includes ($expand), etc. I don't have a lot of "Updates/Deletes/Inserts" and our Data is fairly relational.

I hope others will join in the discussion and give their thoughts. I'm still deciding and would love to hear other opinions. I really think both are frameworks are great. I wonder if you have to even choose, why not use both if needed. From the Client it's all about building REST calls anyways. Just a thought :)

Web Api has a new preview for OData support that adds missing peacies and puts it on the same foundation that WCF DS uses: [link][blogs.msdn.com/b/alexj/archive/2012/08/15/

@JohannesRudolph - The link you gave sounds interesting but is broken.

Web Api also just needs this small bit of love to work on versions of Excel prior to 2013: aspnetwebstack.codeplex.com/workitem/820

As we are in 2014 now, Microsoft has an interesting blog post blogs.msdn.com/b/odatateam/archive/2014/03/27/ to discuss the future of OData support from WCF and WebApi.

rest - WCF Data Services (OData) Vs ASP.NET Web API - Stack Overflow

wcf rest asp.net-web-api wcf-data-services odata
Rectangle 27 1

Even though this is an old thread it actually helped me migrate a project from VS Web Developer Express to MonoDevelop which included a WCF service.

No protocol binding matches the given address

Inspired by this thread I was able to fix the problem because accessing the service with localhost instead of 127.0.0.1 worked! With a request to http://localhost:8080/path-to-service/service.svc/js I got the JavaScript interface.

Actually my application didn't use an absolute URL to include the JavaScript interface, however by default when starting the application from MonoDevelop it would access the application using 127.0.0.1, thus the call to include JavaScript from the service failed.

It's still not perfect since I haven't been able to start the application from MonoDevelop using localhost instead of 127.0.0.1, since the configuration for XSP only allows me to specify an IP address, but at least I know how to get around it.

web services - WCF WebService / IIS Hosting & Configuration Issue Behi...

wcf web-services iis .net-3.5 configuration
Rectangle 27 1

I might be able to prevent Ninja violence... if I understand your problem ... You can manually specify the complete address the service should use in the web.config as opposed to having the ServiceHost figure it out for you. You have to set the base address of your service:

<service behaviorConfiguration="Behaviour1" name="Api.Poll">
    <endpoint address="soap" binding="basicHttpBinding" bindingConfiguration="soapBinding"
      contract="Api.IPoll" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://www.mydomain.com/Api" />
        <add baseAddress="http://10.10.20.30/Api" />
      </baseAddresses>
    </host>
  </service>

Using this method, your service should accept the base address specified, plus the service name, with the additional endpoint address if you have one. Also, you would need to use a custom ServiceHostFactory to set the base address programmatically. See below:

public class ServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactory
{
    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    {                        
        ServiceHost host;

        host = new ServiceHost(serviceType, baseAddresses[0]);

        return host;
    }

Lastly, once you've build the ServiceHostFactory class, you have to hook it up to your service by editing the markup in the .svc file:

<%@ ServiceHost Language="C#" Debug="true" Service="Api.Poll" Factory="Api.ServiceHostFactory" CodeBehind="Poll.svc.cs" %>

The BaseAddress section of the web.config is completely ignored when hosted under IIS. Makes no difference having it present or not. IIS figures out the address based on the Virtual Directory configuration. stackoverflow.com/questions/56249/

Hmm... I've used it before under IIS, but that was a different scenario with multiple base addresses. I wonder if you could use a ServiceHostFactory to set the base address programmatically. See revised answer.

Cheers for this Steve... Its 9pm GMT here so I'll give this a try when I get back to the office and come back to you tomorrow. Can you just clarify where I create this class. Do I just drop it into the App_Code folder and then have my Service Extend this ?

Yeah, you could just put it in the App_Code section, that would work. There's one last step to wire it up though, to do that you have to modify the markup of the .svc file. I've updated the answer to include that.

web services - WCF WebService / IIS Hosting & Configuration Issue Behi...

wcf web-services iis .net-3.5 configuration
Rectangle 27 1

Here's how you change the header in IIS7. Also put my web.config for some if it helps.

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />      
    <customErrors mode="Off"></customErrors>
  </system.web> 
  <system.serviceModel>
    <client/>
    <services>
      <service name="WcfService1.Service1"
behaviorConfiguration="MyServiceTypeBehaviors">
        <host>
        <baseAddresses>
          <add baseAddress="https://pws.sjukra.is/"/>        
        </baseAddresses>
        </host>
        <endpoint address="https://pws.sjukra.is/Service1.svc"
                  listenUri="/" 
        binding="wsHttpBinding"
        contract="WcfService1.IService1"
        bindingConfiguration="myBasicHttpBindingConfig"/>
        <endpoint contract="IMetadataExchange"
   binding="mexHttpsBinding"                   
   address="mex"/>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="myBasicHttpBindingConfig">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Windows" />
            <message clientCredentialType="UserName"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug httpsHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
          <serviceCredentials type="System.ServiceModel.Description.ServiceCredentials">
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfService1.Service1,WcfService1"/>
            <serviceCertificate findValue="pws.sjukra.is" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
              <clientCertificate>
                  <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/>
              </clientCertificate>            
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

web services - WCF WebService / IIS Hosting & Configuration Issue Behi...

wcf web-services iis .net-3.5 configuration
Rectangle 27 1

Must it be an IP address and not an FQDN? By swapping to an FQDN and setting that in the host headers for the site, then binding to it via

cscript //nologo %systemdrive%\inetpub\adminscripts\adsutil.vbs set W3SVC/1/ServerBindings ":80:hostname.example.com"

then recycling the app pool will then produce that host name in the generated WSDL. You get benefits with that - you can setup an internal DNS which resolves that FQDN to the internal IP, and an external DNS which resolves to your firewall IP, then the same system will work without any changes.

web services - WCF WebService / IIS Hosting & Configuration Issue Behi...

wcf web-services iis .net-3.5 configuration
Rectangle 27 2

There's a lot of talks going on regarding the simplicity of asmx web services over WCF. Let me clarify few points here.

  • Its true that novice web service developers will get started easily in asmx web services. Visual Studio does all the work for them and readily creates a Hello World project.
  • But if you can learn WCF (which off course wont take much time) then you can get to see that WCF is also quite simple, and you can go ahead easily.
  • Its important to remember that these said complexities in WCF are actually attributed to the beautiful features that it brings along with it. There are addressing, bindings, contracts and endpoints, services & clients all mentioned in the config file. The beauty is your business logic is segregated and maintained safely. Tomorrow if you need to change the binding from basicHttpBinding to netTcpBinding you can easily create a binding in config file and use it. So all the changes related to clients, communication channels, bindings etc are to be done in the configuration leaving the business logic safe & intact, which makes real good sense.
  • WCF "web services" are part of a much broader spectrum of remote communication enabled through WCF. You will get a much higher degree of flexibility and portability doing things in WCF than through traditional ASMX because WCF is designed, from the ground up, to summarize all of the different distributed programming infrastructures offered by Microsoft. An endpoint in WCF can be communicated with just as easily over SOAP/XML as it can over TCP/binary and to change this medium is simply a configuration file mod. In theory, this reduces the amount of new code needed when porting or changing business needs, targets, etc.
  • Web Services can be accessed only over HTTP & it works in stateless environment, where WCF is flexible because its services can be hosted in different types of applications. You can host your WCF services in Console, Windows Services, IIS & WAS, which are again different ways of creating new projects in Visual Studio.
  • ASMX is older than WCF, and anything ASMX can do so can WCF (and more). Basically you can see WCF as trying to logically group together all the different ways of getting two apps to communicate in the world of Microsoft; ASMX was just one of these many ways and so is now grouped under the WCF umbrella of capabilities.
  • You will always like to use Visual Studio for NET 4.0 or 4.5 as it makes life easy while creating WCF services.
  • The major difference is that Web Services Use XmlSerializer. But WCF Uses DataContractSerializer which is better in Performance as compared to XmlSerializer. That's why WCF performs way better than other communication technology counterparts from .NET like asmx, .NET remoting etc.

Not to forget that I was one of those guys who liked asmx services more than WCF, but that time I was not well aware of WCF services and its capabilities. I was scared of the WCF configurations. But I dared and and tried writing few WCF services of my own, and when I learnt more of WCF, now I have no inhibitions about WCF and I recommend them to anyone & everyone. Happy coding!!!

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 2

There's a lot of talks going on regarding the simplicity of asmx web services over WCF. Let me clarify few points here.

  • Its true that novice web service developers will get started easily in asmx web services. Visual Studio does all the work for them and readily creates a Hello World project.
  • But if you can learn WCF (which off course wont take much time) then you can get to see that WCF is also quite simple, and you can go ahead easily.
  • Its important to remember that these said complexities in WCF are actually attributed to the beautiful features that it brings along with it. There are addressing, bindings, contracts and endpoints, services & clients all mentioned in the config file. The beauty is your business logic is segregated and maintained safely. Tomorrow if you need to change the binding from basicHttpBinding to netTcpBinding you can easily create a binding in config file and use it. So all the changes related to clients, communication channels, bindings etc are to be done in the configuration leaving the business logic safe & intact, which makes real good sense.
  • WCF "web services" are part of a much broader spectrum of remote communication enabled through WCF. You will get a much higher degree of flexibility and portability doing things in WCF than through traditional ASMX because WCF is designed, from the ground up, to summarize all of the different distributed programming infrastructures offered by Microsoft. An endpoint in WCF can be communicated with just as easily over SOAP/XML as it can over TCP/binary and to change this medium is simply a configuration file mod. In theory, this reduces the amount of new code needed when porting or changing business needs, targets, etc.
  • Web Services can be accessed only over HTTP & it works in stateless environment, where WCF is flexible because its services can be hosted in different types of applications. You can host your WCF services in Console, Windows Services, IIS & WAS, which are again different ways of creating new projects in Visual Studio.
  • ASMX is older than WCF, and anything ASMX can do so can WCF (and more). Basically you can see WCF as trying to logically group together all the different ways of getting two apps to communicate in the world of Microsoft; ASMX was just one of these many ways and so is now grouped under the WCF umbrella of capabilities.
  • You will always like to use Visual Studio for NET 4.0 or 4.5 as it makes life easy while creating WCF services.
  • The major difference is that Web Services Use XmlSerializer. But WCF Uses DataContractSerializer which is better in Performance as compared to XmlSerializer. That's why WCF performs way better than other communication technology counterparts from .NET like asmx, .NET remoting etc.

Not to forget that I was one of those guys who liked asmx services more than WCF, but that time I was not well aware of WCF services and its capabilities. I was scared of the WCF configurations. But I dared and and tried writing few WCF services of my own, and when I learnt more of WCF, now I have no inhibitions about WCF and I recommend them to anyone & everyone. Happy coding!!!

What are the differences between WCF and ASMX web services? - Stack Ov...

wcf web-services asmx
Rectangle 27 27

WCF is a replacement for all earlier web service technologies from Microsoft. It also does a lot more than what is traditionally considered as "web services".

WCF "web services" are part of a much broader spectrum of remote communication enabled through WCF. You will get a much higher degree of flexibility and portability doing things in WCF than through traditional ASMX because WCF is designed, from the ground up, to summarize all of the different distributed programming infrastructures offered by Microsoft. An endpoint in WCF can be communicated with just as easily over SOAP/XML as it can over TCP/binary and to change this medium is simply a configuration file mod. In theory, this reduces the amount of new code needed when porting or changing business needs, targets, etc.

ASMX is older than WCF, and anything ASMX can do so can WCF (and more). Basically you can see WCF as trying to logically group together all the different ways of getting two apps to communicate in the world of Microsoft; ASMX was just one of these many ways and so is now grouped under the WCF umbrella of capabilities.

Web Services can be accessed only over HTTP & it works in stateless environment, where WCF is flexible because its services can be hosted in different types of applications. Common scenarios for hosting WCF services are IIS,WAS, Self-hosting, Managed Windows Service.

The major difference is that Web Services Use XmlSerializer. But WCF Uses DataContractSerializer which is better in performance as compared to XmlSerializer.

Random note: A big difference of DataContractSerializer and XmlSerializer is that DCS requires field ordering - which is why I don't use DCS for non-transient serialization or contracts! Thus it's possible to break a service used by clients not using the fixed ordering when moving to DCS (or moving to DCS but in a different order than was previously used). Granted, this should be expressed in the Schema, but ..

Also, please cite/link sources and indicate extracts and/or take the original information and write something new with it. It's rude to steal. I've added the link for you, but make sure to give credit where it is due! (I would downvote on this basis, if I could downvote at all.)

Web Service vs WCF Service - Stack Overflow

wcf web-services
Rectangle 27 27

WCF is a replacement for all earlier web service technologies from Microsoft. It also does a lot more than what is traditionally considered as "web services".

WCF "web services" are part of a much broader spectrum of remote communication enabled through WCF. You will get a much higher degree of flexibility and portability doing things in WCF than through traditional ASMX because WCF is designed, from the ground up, to summarize all of the different distributed programming infrastructures offered by Microsoft. An endpoint in WCF can be communicated with just as easily over SOAP/XML as it can over TCP/binary and to change this medium is simply a configuration file mod. In theory, this reduces the amount of new code needed when porting or changing business needs, targets, etc.

ASMX is older than WCF, and anything ASMX can do so can WCF (and more). Basically you can see WCF as trying to logically group together all the different ways of getting two apps to communicate in the world of Microsoft; ASMX was just one of these many ways and so is now grouped under the WCF umbrella of capabilities.

Web Services can be accessed only over HTTP & it works in stateless environment, where WCF is flexible because its services can be hosted in different types of applications. Common scenarios for hosting WCF services are IIS,WAS, Self-hosting, Managed Windows Service.

The major difference is that Web Services Use XmlSerializer. But WCF Uses DataContractSerializer which is better in performance as compared to XmlSerializer.

Random note: A big difference of DataContractSerializer and XmlSerializer is that DCS requires field ordering - which is why I don't use DCS for non-transient serialization or contracts! Thus it's possible to break a service used by clients not using the fixed ordering when moving to DCS (or moving to DCS but in a different order than was previously used). Granted, this should be expressed in the Schema, but ..

Also, please cite/link sources and indicate extracts and/or take the original information and write something new with it. It's rude to steal. I've added the link for you, but make sure to give credit where it is due! (I would downvote on this basis, if I could downvote at all.)

Web Service vs WCF Service - Stack Overflow

wcf web-services
Rectangle 27 11

You should find it extremely simple to convert - especially if your existing asmx web methods are just calling into other classes. Just create a new WCF Service from Visual Studio - that way you still have your existing web services intact. It will automatically create an http end-point for your so you can just dump it straight into IIS (with a little configuration). You will need to describe your DataContract classes but that it trivially simple too.

I did this recently and it was a joy!

Having actually done it - I wouldn't call the overall effort extremely easy. But I am glad you sold it as being easy - or else I might have not even tried. I have to make the following recommendations to those willing to make the switch. 1... You're going to loose out on the http test form, and will need to install a seperate test client, 2 - You will need to learn how WCF slots together, and the configuration can be overly complicated. 3... You're going to need to watch what type of errors you throw back, SOAP exceptions just won't cut it. 4... Its tricky keeping an http context.

It's true that you lose the web service test page, but you gain (for free) the WCF Test Client which is infinitely better :).

c# - How much effort is required to convert an ASMX to WCF web service...

c# wcf asmx
Rectangle 27 11

You should find it extremely simple to convert - especially if your existing asmx web methods are just calling into other classes. Just create a new WCF Service from Visual Studio - that way you still have your existing web services intact. It will automatically create an http end-point for your so you can just dump it straight into IIS (with a little configuration). You will need to describe your DataContract classes but that it trivially simple too.

I did this recently and it was a joy!

Having actually done it - I wouldn't call the overall effort extremely easy. But I am glad you sold it as being easy - or else I might have not even tried. I have to make the following recommendations to those willing to make the switch. 1... You're going to loose out on the http test form, and will need to install a seperate test client, 2 - You will need to learn how WCF slots together, and the configuration can be overly complicated. 3... You're going to need to watch what type of errors you throw back, SOAP exceptions just won't cut it. 4... Its tricky keeping an http context.

It's true that you lose the web service test page, but you gain (for free) the WCF Test Client which is infinitely better :).

c# - How much effort is required to convert an ASMX to WCF web service...

c# wcf asmx
Rectangle 27 1

Yes, there's a list of the configuration sections that WCF uses, just about everything for your services and clients is located in the ServiceModel section. Refer to the system.serviceModel MSDN article for a complete overview. Here's a list of the first level of sub-elements allowed in that section:

<behaviors>
<bindings>
<client>
<comContracts>
<commonBehaviors>
<diagnostics>
<extensions>
<protocolMapping>
<routing>
<serviceHostingEnvironment>
<services> 
<standardEndpoints>

Of course there may be a few other web/app config sections on which WCF relies, for example if you have TraceListeners defined, etc.

web services - Clean config after porting asmx to WCF? - Stack Overflo...

wcf web-services web-config asmx