Windows Vista Forums

creating website programmatically using C#
  1. #1


    Mandar Guest

    creating website programmatically using C#

    Hi,

    I have written some code in C# to programmatically create a website
    and an application pool. Both seems to be getting created alright with
    whatever settings I have applied. However, when I fire a request to
    the website, I get a "page can not be displayed" message". I get
    nothing in the event viewer logs. I read somewhere that from website
    properties > Home Directory > Application Settings, if I remove and
    recreate the application pool, website starts serving requests. This
    DOES work but I am unable to figure out how to accomplish this from my
    code. When I checked Metabase.XML file of IIS before and after doing
    this change manually, only change I noticed that following gets added
    inside <IIsWebVirtualDir>.

    UNCPassword="49634462500000000600000040000000bd77b5e56b3f000048866b15ac840f0bc531565bfc2a1b5c6eb77c9661f527ba8edd7344f93776e7cf6ae118bcdb8db8a6ea143d7ae1d03c8672ac2c84bd677cd3fde3c37cf6e6a0"

    However, my app pool is running under "local system" identity. So this
    string might correspond to some default encrypted string.

    Does anyone know how to get it working from my code?

    Thanks,
    Mandar



      My System SpecsSystem Spec

  2. #2


    Marc Gravell Guest

    Re: creating website programmatically using C#

    I don't know what the error is - however, running a web-site as "local
    system" seems very, very dangerous... is there any good reason it
    needs that level of power? "least priveleged", 'n all...

    Marc

      My System SpecsSystem Spec

  3. #3


    G.S. Guest

    Re: creating website programmatically using C#

    On Sep 9, 8:33*am, Mandar <mandarpkulka...@xxxxxx> wrote:

    > Hi,
    >
    > I have written some code in C# to programmatically create a website
    > and an application pool. Both seems to be getting created alright with
    > whatever settings I have applied. However, when I fire a request to
    > the website, I get a "page can not be displayed" message". I get
    > nothing in the event viewer logs. I read somewhere that from website
    > properties > Home Directory > Application Settings, if I remove and
    > recreate the application pool, website starts serving requests. This
    > DOES work but I am unable to figure out how to accomplish this from my
    > code. When I checked Metabase.XML file of IIS before and after doing
    > this change manually, only change I noticed that following gets added
    > inside <IIsWebVirtualDir>.
    >
    > UNCPassword="49634462500000000600000040000000bd77b5e56b3f000048866b15ac840f*0bc531565bfc2a1b5c6eb77c9661f527ba8edd7344f93776e7cf6ae118bcdb8db8a6ea143d7*ae1d03c8672ac2c84bd677cd3fde3c37cf6e6a0"
    >
    > However, my app pool is running under "local system" identity. So this
    > string might correspond to some default encrypted string.
    >
    > Does anyone know how to get it working from my code?
    >
    > Thanks,
    > Mandar
    Most likely the "page can not be displayed" has error number... 500
    being "Server Error" may contain additional information - the strings
    IE displays under "Technical Information" on 500 errors. You could try
    to reproduce the error inside IE.

    Or it could be a 403

    or even "page not found"

      My System SpecsSystem Spec

  4. #4


    Mandar Guest

    Re: creating website programmatically using C#

    >>> You could try to reproduce the error inside IE.

    @G.S. - In IE I get the following -

    <snip>
    More information


    This problem can be caused by a variety of issues, including:


    Internet connectivity has been lost.
    The website is temporarily unavailable.
    The Domain Name Server (DNS) is not reachable.
    The Domain Name Server (DNS) does not have a listing for the
    website's
    domain.
    If this is an HTTPS (secure) address, click tools, click Internet
    Options, click Advanced, and check to be sure the SSL and TLS
    protocols are enabled under the security section.
    </snip>


    But I dont think any of this holds true for me.



    >>> running a web-site as "local system" seems very, very dangerous...

    @Marc - I am writing an installer where I need to create a web site
    and provide user with possible identity options as - Local System and
    User Configurable. Thats not my issue here.

    The fact that I can make the website working by just recreating the
    application under the website leads me to believe that I have done
    something wrong in my code or something is missing that should be
    there. Any pointers?


    Thanks,
    Mandar



      My System SpecsSystem Spec

  5. #5


    G.S. Guest

    Re: creating website programmatically using C#

    On Sep 10, 11:35*am, Mandar <mandarpkulka...@xxxxxx> wrote:

    > >>> You could try to reproduce the error inside IE.
    >
    > @G.S. - In IE I get the following -
    >
    > <snip>
    > More information
    >
    > This problem can be caused by a variety of issues, including:
    >
    > Internet connectivity has been lost.
    > The website is temporarily unavailable.
    > The Domain Name Server (DNS) is not reachable.
    > The Domain Name Server (DNS) does not have a listing for the
    > website's
    > domain.
    > If this is an HTTPS (secure) address, click tools, click Internet
    > Options, click Advanced, and check to be sure the SSL and TLS
    > protocols are enabled under the security section.
    > </snip>
    >
    > But I dont think any of this holds true for me.
    >

    > >>> running a web-site as "local system" seems very, very dangerous...
    >
    > @Marc - I am writing an installer where I need to create a web site
    > and provide user with possible identity options as - Local System and
    > User Configurable. Thats not my issue here.
    >
    > The fact that I can make the website working by just recreating the
    > application under the website leads me to believe that I have done
    > something wrong in my code or something is missing that should be
    > there. Any pointers?
    >
    > Thanks,
    > Mandar
    Mandar, if the IE snipped is all you get, then that's probably HTTP
    404 "Not found" response which may indicate that your request (URL)
    was not correct or the server refused to serve it w/o providing
    details. This was not the response I was expecting when permissions
    are the issue, but I may be wrong.

    I would definitely try to confirm the exact HTTP response code/error
    you're getting back with that "Page Cannot be Displayed"

    I would also try to make the website work as a stand-alone website
    before going back and debugging from within your code.

    Setting up IIS logging for that website may be helpful as well.
    There's lots of resources on IIS logging - here's one you can start
    with:
    How to configure Web site logging in Windows Server 2003
    http://support.microsoft.com/kb/324279

      My System SpecsSystem Spec

creating website programmatically using C# problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Enable remote WMI programmatically? Karl Mitschke PowerShell 1 19 Oct 2009
programmatically change dns a record voodooking PowerShell 1 25 Jun 2008
programmatically updating vb6 application JTL Vista file management 0 07 May 2008
Detect 3GB switch programmatically scorpneo@gmail.com Vista General 0 23 May 2007
Creating DataTemplates Programmatically? Andrew C Avalon 0 13 Jun 2006