« Previous Next »

Answered Thread: Getting autogenerated URL's to reference an external FQDN and not the server name

Last post 06-11-2009 9:02 AM by rkuite. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 07-03-2008, 9:11 AM

    • rkuite
    • Not Ranked
    • Joined on 06-12-2007, 2:40 PM
    • Posts 4

    Getting autogenerated URL's to reference an external FQDN and not the server name

    Our 2008/IIS 7 server has an internal name of KWST1 but an entirely different external name (kiosk2test).   The application uses WCF and has a web service.  Any URL generated inside the .svc or the .wsdl reference the internal server name (https://kwst1.domain-name.com/appname/Service.svc?wsdl) instead of the desired URL of (https://kiosk2test.domain-name.com/appname/Service.svc?wsdl)

    In IIS 6.0 we accomplished this through the IIS admin script
    cscript adsutil.vbs set w3svc/1/UseHostName true
    cscript adsutil.vbs set w3svc/1/SetHostName kiosk2test.domainname.com

    How is this accomplished under IIS 7.0?

    Thanks-
    Randy

  • 07-03-2008, 10:20 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Getting autogenerated URL's to reference an external FQDN and not the server name

    The equivalent setting on IIS7 is

    %windir%\system32\inetsrv\appcmd.exe set config "Default Web Site" -section:system.webServer/serverRuntime -alternateHostName:<value>

    I would be surprised however if webservices honor this setting when generating urls to send back to the client.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 07-03-2008, 3:36 PM In reply to

    • rkuite
    • Not Ranked
    • Joined on 06-12-2007, 2:40 PM
    • Posts 4

    Re: Getting autogenerated URL's to reference an external FQDN and not the server name

    anilr:

    The equivalent setting on IIS7 is

    %windir%\system32\inetsrv\appcmd.exe set config "Default Web Site" -section:system.webServer/serverRuntime -alternateHostName:<value>

     When I attempt this command on the server when logged in as Administrator, I received the error...

    ERROR ( message:Can not set attribute "alternateHostName" to value kiosk2test.domainname.com".. Reason: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"

    Additional background information is that our site has SSL enforced across the site.

    Any ideas on what to try next?

    Your help is greatly appreciated.
    -Randy

  • 07-03-2008, 8:54 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Answered Re: Getting autogenerated URL's to reference an external FQDN and not the server name

    That just means that the configuration section is locked on the server level - just add a "-commitpath:apphost" to that command-line to have the config change be written to applicationhost.config - or you can unlock the section using "appcmd unlock config -section:system.webServer/serverRuntime"

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 06-10-2009, 9:52 AM In reply to

    • pure.krome
    • Top 100 Contributor
    • Joined on 05-28-2006, 4:45 AM
    • Melbourne, Australia
    • Posts 59

    Re: Getting autogenerated URL's to reference an external FQDN and not the server name

    Sorry to raise this old thread, but is it possible to unlock that section via IIS Manager, or only via the command line?

  • 06-11-2009, 9:02 AM In reply to

    • rkuite
    • Not Ranked
    • Joined on 06-12-2007, 2:40 PM
    • Posts 4

    Re: Getting autogenerated URL's to reference an external FQDN and not the server name

    I could never get it to work as intended through the GUI or script interface... I ending up manually editing the ApplicationHost.config file

    To correct the hostname...
    -Open Windows Explorer
    -Navigate to C:\Windows\System32\InetSrv\Config\
    -Open the file ApplicationHost.config with notepad
    -Search for "bindings"
    -In the bindings section edit the line for http and add in the hostname / domain name to match your URL reference instead of the machine name.
     
Page 1 of 1 (6 items)
Microsoft Communities