locked
Code behind not working RRS feed

  • Question

  • User-1173082540 posted

    I have recently inherited an asp.net vb web application.  It currently runs from a windows 2003 server, which we are in the process of replacing.  I need to demonstrate the site operating on the new Dev server before we deploy to the new web host.  When I run the site from VS it works just fine.  Then I publish to the the dev server's iis (same machine) and the page is mostly blank.

    The  code behind is not being run.  Most of the content for the page is being generated in the code behind (pulling content from the database) and I found that if I comment out the content of the Page_Load event I get the same results when debugging.  

    The closest I've found in research says to change from codebehind to codefile, but that just creates a larger error, and it wants the individual aspx.vb files to be deployed.  I want to be able to run the site just as it was run before.  Are there any suggestions as to why this might be happening?

    Friday, December 18, 2015 5:45 PM

Answers

  • User753101303 posted

    Hi,

    "mostly" blank or "entirely" blank? Have you tried to look at the Windows log to see if you have a message? Are exception handled properly ? My first thought would be that some settings in the web.config (such as the db server connection string) is not valid for this new server.

    Or it could be that the new db (or do you connect to the same data?) doesn't have any data and so doesn't have anything to show resulting in a page which is "mostly" blank.

    As I like to tell often, it is usually much easier to take the time to see what happens exactly (ie what is the exact behavior or to find some actual error message) to then  understand why this PARTICULAR problem happens rather than to just see that something "doesn't work" and then wondering why (you have much more possible causes as you don't even know what is the problem).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 18, 2015 5:55 PM

All replies

  • User753101303 posted

    Hi,

    "mostly" blank or "entirely" blank? Have you tried to look at the Windows log to see if you have a message? Are exception handled properly ? My first thought would be that some settings in the web.config (such as the db server connection string) is not valid for this new server.

    Or it could be that the new db (or do you connect to the same data?) doesn't have any data and so doesn't have anything to show resulting in a page which is "mostly" blank.

    As I like to tell often, it is usually much easier to take the time to see what happens exactly (ie what is the exact behavior or to find some actual error message) to then  understand why this PARTICULAR problem happens rather than to just see that something "doesn't work" and then wondering why (you have much more possible causes as you don't even know what is the problem).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 18, 2015 5:55 PM
  • User-1173082540 posted

    Mostly blank.  The Master page formatting is being displayed, but the content that would be pulled from the database is not there.

    I had checked the connection string before, multiple times, but on your suggestion I checked it again and noticed that I was using Trusted_Connection=true.  This, of course, works for debugging.  I changed it to the web db user and that solved it.  Thanks for asking me to check my p's and q's again, apparently that's what I needed.

    Friday, December 18, 2015 6:41 PM
  • User753101303 posted

    Great to see this is solved. You should have an error message such as "login failed for user 'IIS APPPOOL\DefaultAppPool'" in the event log. It allows then to see that the issue is that the account under which the IIS app is running is used but not allowed to access the db (and so not using integrated security is a way to solve this).

    Friday, December 18, 2015 7:29 PM