none
Host WCF in Windows server 2008 R2 and IIS7.5 RRS feed

  • Question

  • Hello,

    I have WCF Web service created in framework 4.0. I have deployed a web service on wondows 2008 R2 and iis 7.5. The web service works fine when I call it from asp.net client application internally. But it fails from client machine. The client application is created using perl and c. The client application is running on windows 7.

    I have to use domain IP in URL to call the web service. Somehow the domain IP is missing URI when client calls the web service. I do not have any issue when I deploy this web service on windows 2003 and iis 6.

    Please Help.

    Event code: 3005 
    Event message: An unhandled exception has occurred. 
    Event time: 1/1/2014 7:51:06 AM 
    Event time (UTC): 12/31/2013 11:51:06 PM 
    Event ID: 9272539752b04333829051de3074452c 
    Event sequence: 2 
    Event occurrence: 1 
    Event detail code: 0 

    Application information: 
        Application domain: /LM/W3SVC/4/ROOT-1-13033007466599---- 
        Trust level: Full 
        Application Virtual Path: / 
        Application Path: C:\inetpub\wwwroot\MyWFCService\ 
        Machine name: MyServer 

    Process information: 
        Process ID: 2652 
        Process name: w3wp.exe 
        Account name: NT AUTHORITY\NETWORK SERVICE 

    Exception information: 
        Exception type: UriFormatException 
        Exception message: Invalid URI: The hostname could not be parsed.
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
       at System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar)
       at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)



    Request information: 
        Request URL: http://:83/Service.svc/GetInformation 
        Request path: /Service.svc/GetInformation 
        User host address:[User HostIP Here] 
        User:  
        Is authenticated: False 
        Authentication Type:  
        Thread account name: NT AUTHORITY\NETWORK SERVICE 

    Thread information: 
        Thread ID: 9 
        Thread account name: NT AUTHORITY\NETWORK SERVICE 
        Is impersonating: False 
        Stack trace:    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
       at System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar)
       at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)


    Custom event details: 

    Please Help.

    Thank you.

            
    Wednesday, January 8, 2014 8:18 PM

All replies

  • Hi,

    I see that your web service works fine when you call it from asp.net client application internally. But it fails from client machine which is a c application. So the wcf service is fine.

    Please try to check the following articles about how to call wcf service from the c application.

    http://blogs.msdn.com/b/nikolad/archive/2009/02/18/creating-client-to-wcf-services-that-uses-wshttpbinding.aspx .

    Also please try to follow this blog below, you can download a demo here.

    http://blogs.msdn.com/b/nikolad/archive/2009/03/03/demo-of-wwsapi-from-mvp-summit.aspx .

    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.


    Friday, January 10, 2014 9:36 AM
    Moderator
  • Hi Amy,

    Thanks for reply.

    We have same client application(in c), calling the same WCF web service deployed on windows server 2003 and IIS 6 which works fine. The only difference is that we deploy wcf web service on IIS 7.5 on windows server 2008 R2 and it is not working from the same client.

    I am not sure if client needs to change the config file or not.

    Thank you.

    Friday, January 10, 2014 6:39 PM
  • Hi,

    From your description, I know that it can work fine when the WCF web service deployed on windows server 2003 and IIS 6. But it do not work on IIS 7.5 on windows server 2008 R2. Maybe you have not done some settings in the IIS7.5.

    Please try to check the following article:
    #Walkthrough on creating WCF 4.0 Service and Hosting in IIS 7.5:
    http://beyondrelational.com/modules/2/blogs/48/posts/10055/walkthrough-on-creating-wcf-40-service-and-hosting-in-iis-75.aspx .

    Also it will be better if you can post your config 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.

    Friday, January 17, 2014 10:03 AM
    Moderator
  • Hello,

    here id the web.config file.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
           <system.webServer>
                 <httpErrors errorMode="DetailedLocalOnly" />
                 <tracing>
                     <traceFailedRequests>
                          <add path="*">
                                <traceAreas>
                                    <add provider="ASP" verbosity="Verbose" />
                                      <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices"  verbosity="Verbose" />
                                       <add provider="ISAPI Extension" verbosity="Verbose" />
                                       <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
                        </traceAreas>
                        <failureDefinitions timeTaken="00:00:00" statusCodes="200-999" />
                    </add>
                </traceFailedRequests>
            </tracing>

            <defaultDocument>
                <files>
                    <add value="Service.svc" />
                </files>
            </defaultDocument>
            <directoryBrowse enabled="true" />
            <urlCompression doStaticCompression="false" />
            <handlers>
                <add name="aspnet_isapi 32-bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
            </handlers>
        </system.webServer>

        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            <compilation debug="true" targetFramework="4.0" />
            <identity impersonate="false" />
            <authentication mode="Windows" />
        </system.web>


        <system.serviceModel>


            <serviceHostingEnvironment>
                <serviceActivations>
                    <add factory="System.ServiceModel.Activation.WebServiceHostFactory" relativeAddress="./MyService/Service.svc" service="IService" />
                </serviceActivations>
            </serviceHostingEnvironment>

            <services>
                <service behaviorConfiguration="MyServiceBehavior" name="Service">
                    <endpoint address="" behaviorConfiguration="jsonEndpointBehavior" binding="webHttpBinding" name="json" contract="IService">
                        <identity>
                            <dns value="localhost" />
                        </identity>
                    </endpoint>

                    <endpoint address="wsHttpBinding" behaviorConfiguration="wsHttpBinding" binding="wsHttpBinding" bindingConfiguration="" name="wsHttpBinding" contract="IService">
                        <identity>
                            <dns value="localhost/wsHttpBinding" />
                        </identity>
                    </endpoint>
                    <host>
                        <baseAddresses>
                            <add baseAddress="http://localhost:83/Service" />
                        </baseAddresses>
                    </host>
                    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                </service>
            </services>

            <behaviors>
                <serviceBehaviors>
                    <behavior name="MyServiceBehavior">
                        <serviceMetadata httpGetEnabled="true" />
                        <serviceDebug includeExceptionDetailInFaults="true" />
                    </behavior>
                </serviceBehaviors>
                <endpointBehaviors>
                    <behavior name="jsonEndpointBehavior">
                        <webHttp />
                    </behavior>
                    <behavior name="wsHttpBinding" />
                </endpointBehaviors>

            </behaviors>
        </system.serviceModel>

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

    </configuration>

    FYI, the client application is running on 32-bit machine. Now I am getting following error for ServiceModel-4.0. Authentication type is Anonymous.

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
     <System>
      <Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
      <EventID>0</EventID>
      <Version>1</Version>
      <Level>3</Level>
      <Opcode>16</Opcode>
      <Keywords>0x100</Keywords>
      <TimeCreated SystemTime="2014-01-17T19:37:38.654Z"/>
      <Correlation ActivityID="{00000000-0000-0000-5F00-0080000000FD}"/>
      <Execution ProcessID="2404" ThreadID="5596"/>
      <Computer>localhost</Computer>
     </System>
     <EventData>
      <Data Name="ContextId">{00000000-0000-0000-5F00-0080000000FD}</Data>
      <Data Name="ModuleName">ServiceModel-4.0</Data>
      <Data Name="Notification">2</Data>
      <Data Name="HttpStatus">401</Data>
      <Data Name="HttpReason">Unauthorized</Data>
      <Data Name="HttpSubStatus">0</Data>
      <Data Name="ErrorCode">0</Data>
      <Data Name="ConfigExceptionInfo"></Data>
     </EventData>
     <RenderingInfo Culture="en-US">
      <Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
      <Keywords>
       <Keyword>RequestNotifications</Keyword>
      </Keywords>
      <freb:Description Data="Notification">AUTHENTICATE_REQUEST</freb:Description>
      <freb:Description Data="ErrorCode">The operation completed successfully.
     (0x0)</freb:Description>
     </RenderingInfo>
     <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
      <EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
     </ExtendedTracingInfo>
    </Event>


    Thanks,

    JPatel

    Friday, January 17, 2014 9:26 PM