locked
Tried to duplicate entire folder of working website, it only shows fiiles, will not serve pages? IIS problem? RRS feed

  • Question

  • User2142845853 posted

    We have windows server, in a directory there is a folder of the project/solution that is loaded to write the code.  Trying to branch and take the working version but modify it, I made a copy, pasted it into the same working folder, then renamed the project, did a refactor and renamed the namespace, tried to make sure folder paths point to the new name.

    Have done this 3 different times so far.  Instead of serve the page it lists the files.  but this is a folder of a working project with all the settings as they should be.  Searching for solutions, many will say change the configuration page, or change some setting in the project, but theyre already set.  So it may be an IIS setting that needs to take place to tell it to serve the files?

    What needs to be set for IIS to serve the pages not display contents?

    thanks

    Monday, October 30, 2017 3:19 PM

All replies

  • User-359936451 posted

    If you need to change your production site, or want a copy of it, try this.

    First you need to stop IIS. 

    Then, zip the folder that the site is in. I am guessing this is a web app, VB or C#.

    Copy the zip file to a working folder on a development PC, Documents/devWebSite/ or something like that. 

    Now, I am also guessing that you did not have a solution file in the production web site folder. This sort of depends on the version of visual studio you are using. 

    But now on your Dev PC, you should be able to open the web site and work on the pages. When you go to close or exit, it will ask to create a solution or project file, this depends on what your actually working with and again the version of VS.  Let VS do this. That is how you will open the project in the future.

    Monday, October 30, 2017 7:12 PM
  • User2142845853 posted

    it is C# MVC and the original folder has been in use for 6+ months, all the settings are good, the website on this works just fine.  And it has to stay on the server because of accessing some database items, if its local?  Its blocked and cannot get to the database.  So its got to be resident on the Server machine.

    Its just difficult because changing all the names and running, it compiles but instead of the home/index page?  It shows a directory of files.  None of the configuration was changed from the working one, only naming.  

    So in the IIS looking at the IIS Manager, am trying to configure so it will serve the pages, seems like a very simple setting

    but are you saying just copy all of it and delete the solution .SLN file and let VS create it? And this will let it run as served pages?

    thanks

    Monday, October 30, 2017 7:25 PM
  • User475983607 posted

    The fact that you're able to browse the directory means MVC is not starting and you have directory browsing enabled in IIS. 

    Other than that, what you are trying to accomplish is not clear.  Are you trying to make a backup of a live MVC application or trying to copy a code base stored on a server or is the live MVC application also the code base?  What are you renaming? 

    Monday, October 30, 2017 8:33 PM
  • User2142845853 posted

    Im trying to branch off of this application and modify it, but keep the original in tact.  

    so I copy the original directory.  I repaste into the same main server directory area, and it auto renames it as whatever(2).  Then I rename that to Mynewfolder. then go and rename the solution.sln and try to give it a new name, manually. 

    Then open the solution, refactor the namespace and make sure nothing references the original folder items.  Since its been a good working program, the settings needed are likely in IIS

    Monday, October 30, 2017 8:46 PM
  • User2053451246 posted

    After you made a copy of the folder did you right-click it and do the Convert to Application step?

    Monday, October 30, 2017 8:55 PM
  • User2142845853 posted

    Yes.  Tried to match up the settings to the existing folder I want to preserve and not touch

    Monday, October 30, 2017 8:58 PM
  • User1771544211 posted

    Hi rogersbr,

    It seems that the duplicate website is not recognized as MVC application by IIS.

    Please try add the following code into your web.config.

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

    Best Regards,

    Jean

    Tuesday, October 31, 2017 1:54 AM
  • User2142845853 posted

    Hi Jean

    Yes its there, it has this line in system.webServer.   So the application is a copy of a working app.  All settings 'should' be correct;   Its the IIS server Im not sure about.

    So you have this working application, and want to make a copy to be able to 'branch' off and try some other code and not affect the original, the copy is put in the same IIS directory and renamed. When run? it will not serve pages only list directory files

    Tuesday, October 31, 2017 2:13 PM
  • User475983607 posted

     the copy is put in the same IIS directory and renamed. 

    I assume you are trying to reuse the existing IIS web application to host both apps?  A copy of production was made inside of the existing IIS app and when accessing the new director, the folder contents are displayed in the browser rather than starting the app.   This approach will NOT work.

    Create a new application in IIS and point the IIS application to the production copy.  Set a the site binding to an unused port like 8080 or 9080.  Be sure to open the port in Windows firewall to allow remote access.

    Consider using source control like GIT.  Otherwise keeping track of changes will become a headache and lead to hair pulling bugs.

     

    Tuesday, October 31, 2017 3:04 PM
  • User2142845853 posted

    Edit: starting with adding a new app in IIS, gets errors, but what Id expect that may be the problem, still not working but closer

    In the IIS system, a dedicated machine with Windows Server on the network, the path is shared so in the working directory path, all the applications exist, 10 or so. My folder was one of them.  I just added another, but did it from a shared network path I didnt create the folder from the IIS.

    So in the directory path are 10 folders and other files, each folder is a project.  I copied my folder then renamed it and renamed internal files and the namespace.

    Will try creating in IIS

    Source control is good, used many of them, necessity increases if more than 1 developer works on a project

    Tuesday, October 31, 2017 3:27 PM
  • User475983607 posted

    In the IIS system, a dedicated machine with Windows Server on the network, the path is shared so in the working directory path, all the applications exist, 10 or so. My folder was one of them.  I just added another, but did it from a shared network path I didnt create the folder from the IIS.

    So in the directory path are 10 folders and other files, each folder is a project.  I copied my folder then renamed it and renamed internal files and the namespace.

    Will try creating in IIS

    Source control is good, used many of them, necessity increases if more than 1 developer works on a project

    What you are describing will work if a virtual directory is created with the main IIS web app.  There is no reason to change file names or namespaces to get the new app working.

    I still recommend creating a new IIS app on another port (or create a DNS entry if you want to use port 80/443).  Again, there is no reason to change file names or namespaces to make this work.

    Source control is good, used many of them, necessity increases if more than 1 developer works on a project

    I can't imagine working without a safety net even if I'm the only developer. 

    Tuesday, October 31, 2017 3:38 PM
  • User2142845853 posted

    Thanks, what will this code do?

    Tuesday, October 31, 2017 5:11 PM
  • User2142845853 posted

    I had a version control system delete/scramble my project contents. Wasnt GIT but popular name brand. Had to recover from backed up folders. Just said forget it, I have a great memory of what got changed and make backup copies weekly or before a big change.

    with version control I still make manual backups.

    I tried without changing any file names, IIS complains, will not let me manage some settings because duplicate names exist.   Seems to be one of these IIS settings

    Tuesday, October 31, 2017 5:27 PM
  • User475983607 posted

    rogersbr

    I tried without changing any file names, IIS complains, will not let me manage some settings because duplicate names exist.   Seems to be one of these IIS settings

    You must create a new IIS application or virtual directory.  This creates isolate between the test and production applications and allow you to have two copies of the app running side by side.

    Tuesday, October 31, 2017 6:06 PM
  • User2142845853 posted

    Ok, Ive been trying, I created a new virtual directory to isolate.  Simply does not work.  Will just leave it and come back, maybe.  need to get javascript controls working first, have to do localhost 

    thanks for your help. I have not done very much with IIS configuration.  Can usually make it or Apache work well.  But this current machine I didnt setup.

    Tuesday, October 31, 2017 6:28 PM
  • User1771544211 posted

    Hi rogersbr,

    When run? it will not serve pages only list directory files

    I run into similar issue before. When I publish the website to IIS and access it. It lists the folder and files instead of showing the ASP.NET default page. I managed to solve this issue as what I posted in my previous answer.

    Please try access your page directly to see what's the result. If it shows an error page, please share the error message here.

    Best Regards,

    Jean

    Wednesday, November 1, 2017 6:27 AM
  • User2142845853 posted

    I have too, and the setting you suggested is assuredly there.  When trying to access a page directly, it points to an error in the config file:

     36:   <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" />

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error: 

    An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.


    Source File: R:\.................\mainapp\web.config    Line: 36 

    Wednesday, November 1, 2017 2:37 PM
  • User475983607 posted

    The error means IIS is not configured correctly.  I'm guessing that the production copy is placed inside another application.  Perhaps the production app?  Anyway, that's a typical error when nesting applications due to web.config inheritance.  Errors like this also happen if the application folder is not a virtual directory or an application.

    Create a production copy at the same level as the production app.  Create a new IIS application and point the app to the production copy.  Set the site binding to an unused port like 8080 or 9080.  Use the same domain as the production app.  You will get a new application pool too.   Start the app from IIS and make sure it starts.  Be sure to allow the new port in the Windows firewall otherwise remote requests will get blocked.

    You might consider visiting an IIS support forum or browser though the IIS documentation or Google how to create an IIS application. 

    https://technet.microsoft.com/en-us/library/cc772042(v=ws.10).aspx

    Wednesday, November 1, 2017 3:38 PM
  • User2142845853 posted

    Ok I do not get it.  Do not know why this is not letting me serve the page.  Have to trim back this/that/the other and still doesnt serve the page.  Trying is like trying to push 2 magnets together on the N-N poles.  

    Guess I need to learn more about the unfriendly IIS and exactly how it works internally.

    Ive done what you said except visiting the other site, will try that next

    Friday, November 3, 2017 6:49 PM