none
WCF REST XML service hosted on IIS 7.5 .NET 4.0 under both: http and https bindings stopped to work after installation of Visual Studio 2013 RRS feed

  • Question

  • Developed using .NET Framework 4.0 WCF REST XML service and hosted on IIS 7.5 worked okay with both bindings: http, https. After installation of Visual Studio 2013 from here:

    http://www.microsoft.com/visualstudio/eng/downloads service became to work only with http binding, when open service in browser using https the message is:

    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.

    The message in Event Viewer is:

    WebHost failed to process a request.
     Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/39086322
     Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'https://{host name}/Services/Service.svc'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'https://{host name}/Services/Service.svc'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
       at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
     Process Name: w3wp
     Process ID: 3568

    If to add to webHttpBinding configuration (in web.config) line: <security mode="Transport" />, then service starts to work with https and stops to work with http protocol (with the same errors in browser and Event Viewer).

    Any ideas how to make this work like it was when only .NET Framework 4.0 and Visual Studio 2010 were installed?

    The same error appears after installation of Visual Studio 2012 or Team Foundation Server 2012 with Update 3.

    Tuesday, October 29, 2013 5:35 PM

All replies

  • Hi,

    So it seems that your service can work at .Net Framework 4.0. but not work at .Net Framework 4.5.

    If so, Could you post your question on netfx45compat at Microsoft dot com to discuss? The microsoft experts will help you to find the cause.

    Also it will be better for you to post your configure file here.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, October 31, 2013 2:35 AM
    Moderator
  • Installation order:

    1) Windows 7;

    2) IIS (ASP.NET);

    3) Visual Studio 2010 with .NET framework 4.0.

    Service implementation:

    IService1.cs:

    namespace Wcf
    {
        [ServiceContract]
        public interface IService1
        {
            [OperationContract]
            [WebInvoke(Method = "GET", UriTemplate = "/GetData/{value}", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
            string GetData(string value);

            [OperationContract]
            [WebInvoke(Method = "POST", UriTemplate = "/GetDataUsingDataContract", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
            CompositeType GetDataUsingDataContract(CompositeType composite);
        }

        [DataContract]
        public class CompositeType
        {
            bool boolValue = true;
            string stringValue = "Hello ";

            [DataMember]
            public bool BoolValue
            {
                get { return boolValue; }
                set { boolValue = value; }
            }

            [DataMember]
            public string StringValue
            {
                get { return stringValue; }
                set { stringValue = value; }
            }
        }
    }

    Service1.svc.cs:

    namespace Wcf
    {
        [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
        public class Service1 : IService1
        {
            public string GetData(string value)
            {
                return string.Format("You entered: {0}", value);
            }

            public CompositeType GetDataUsingDataContract(CompositeType composite)
            {
                if (composite == null)
                {
                    throw new ArgumentNullException("composite");
                }
                if (composite.BoolValue)
                {
                    composite.StringValue += "Suffix";
                }
                return composite;
            }
        }
    }

    Service1.svc:

    <%@ ServiceHost Language="C#" Debug="true" Service="Wcf.Service1"
        Factory="System.ServiceModel.Activation.WebServiceHostFactory"
    %>

    Web.config:

    <?xml version="1.0"?>
    <configuration>

        <system.web>
            <compilation debug="true" targetFramework="4.0" />
        </system.web>

        <system.serviceModel>
            <standardEndpoints>
                <webHttpEndpoint>
                    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false"></standardEndpoint>
                </webHttpEndpoint>
            </standardEndpoints>

            <bindings>
                <webHttpBinding>
                    <binding name="WebHttpBinding_BindingConfig" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                             transferMode="Streamed" >
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                        <!--<security mode="Transport"></security>-->
                    </binding>
                </webHttpBinding>
            </bindings>

            <behaviors>
                <endpointBehaviors>
                    <behavior name="webHttpBehavior">
                        <webHttp helpEnabled="true" />
                    </behavior>
                </endpointBehaviors>

                <serviceBehaviors>
                    <behavior name="CommonServiceBehavior">
                        <serviceMetadata httpGetEnabled="true" />
                        <serviceDebug includeExceptionDetailInFaults="false"/>
                    </behavior>
                </serviceBehaviors>
            </behaviors>

            <services>
                <service name="Wcf.Service1" behaviorConfiguration="CommonServiceBehavior">
                    <endpoint address="" behaviorConfiguration="webHttpBehavior"
                             binding="webHttpBinding" bindingConfiguration="WebHttpBinding_BindingConfig"
                             contract="Wcf.IService1" />
                </service>
            </services>

            <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
        </system.serviceModel>

        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"/>
        </system.webServer>

    </configuration>

    host (C:\Windows\System32\drivers\etc):

    127.0.0.1    wcf

    IIS bindings configuration:

    %systemroot%\system32\inetsrv\appcmd set site /site.name:WCF /bindings.[protocol='http',bindingInformation='*:80:'].bindingInformation:*:80:wcf

    %systemroot%\system32\inetsrv\appcmd set site /site.name:WCF /bindings.[protocol='https',bindingInformation='*:443:'].bindingInformation:*:443:wcf

    This works okay with .NET framework 4.0, but after installation of .NET framework 4.5 error appears as was described in the first post.

    The service works only via http protocol, if to uncomment <security mode="Transport"></security> in the web.config, then service will only work via https.

    If only .NET framework 4.0 installed both protocols are okay.

    Friday, November 1, 2013 5:00 PM