Web app showing different screen at visual studio and Azure - c#

I am maintaining an app, developed by someone else who is not in the organization anymore.
And my skill with .net is very limited. (Can run and deploy the code.)
As you can see in the image, the same code and same database it works fine in visual studio, I can see the table with columns. But the deployed code in Azure is not showing the table.
Just want to check with experts here, if you see anything obvious missing here?
Just a bit of background about the above Table: It is a dynamic table, Admin can customize the table columns, width, etc.
Apologies for the silly question, but just trying if I can get a quick win by asking it here.
Cheers David

This could be due to a runtime issue, which occurs when the files in your wwwroot folder are precisely what they should be, but the site doesn't function correctly for some reason, such as a missing element, or it could be due to a change in how the page is viewed.
After you've deployed, check your Kudu Console to see if the View of the controller you're deploying has changed.
I tried reproducing the same and this is how I compared my Kudu Console.cshtml and VS Code.cshtml files.
Here is the output

When I ran in inspect mode found some of the .js files were showing 404 error.
Checked the visual studio and for some reason, those were not added to the project!!
So I had to manually include them in the project. After publishing it is now working fine.

Related

Visual Studio Web Apps Publish fails - no errors

I have several ASP.Net web form apps in a Visual Studio project. In one of the apps, I was working to add a test page for some additional features we wanted to test before adding to our main pages. Afterwards however, I was trying to publish to our server, but keep getting a message box saying: "The publish has failed due to one or more errors.".
Build succeeded Image
Publish Failed Image
I checked the errors, but none are given. The build was successful and other then a few un-used references, there are no other indicators on what the issue exactly is. We have a few other projects that normally allow for publishing without issues. So I don't believe the issue is from Visual Studio, but I am not completely sure. I'm using Visual Studio 2015 version 14.0.24720.00
Figured it out!
There is a Thumbs.db file that was auto-generated in the images folder. I decided to go through the output window line by line to see if I could identify where the publish was failing at. I noticed a line that said the /Images/Thumbs.db file could not be published and that access was denied.
Doing some more online investigating, I found some other questions along the same line as the premise for this one. Specifically the question here was most helpful. Tammy Spencer's (#user:973679) answer to try and delete the file was what made the publish succeed. So thank you Tammy.
In addition, the Thumbs.db file wouldn't let me delete it at first. But after doing some more searching, I found this YouTube video that made the file deletable.

ASP.NET Core Browser Link `Unable to get property 'files'`

In the Microsoft Virtual Academy course 'Introduction to ASP.NET Core (formerly ASP.NET 5)', video 3, at 39:00, they demonstrate how Browser Link can sync code selection between Edge's F12 tools and Visual Studio. I haven't been able to see the same functionality out of the box. I don't know if there's a setting, or something special to enable this. If there is, it wasn't shown in the course video, but then again the video is a couple months old. I've never seen this functionality before.
Browser Link is connected to Visual Studio from Edge, as can be seen in the Browser Link Dashboard in VS. That's all fine.
There is a console log in Edge that seems relevant;
Browser Link: Failed to invoke return value callback:
TypeError: Unable to get property 'files' of undefined or null reference.
browserLink (64,492)
I found the only function in the BrowserLink js that references 'files' and started going up the stack trace. It seems to expect a JSON from localhost:9640/5b39911a4f384282a7625405b2d603cf/browserLinkSignalR with multiple elements, [1] being a list of source files, but is actually null, so catches and posts that console log.
Nothing useful on Google, or their GitHub issues. If there was a relevant Github repo I could be pointed to, I could look it up.
Microsoft Visual Studio Enterprise 2015 Version 14.0.25421.03 Update 3
Microsoft .NET Core Tools (Preview 2) 14.1.20624.0
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
Edge 25.10586.0.0
I fixed this issue by removing the default browserlink package
Microsoft.VisualStudio.Web.BrowserLink
and installing
Microsoft.VisualStudio.Web.BrowserLink.Loader
Here is an updated guide from Microsoft docs
I was also getting other errors in the console about missing css with browserlink and this fixed that too.
Whenever i'm doing something new like this, i would try to find an example project that is leveraging the same feature somewhere on github. I would then build that project and see if it works. If the example project works and yours does not. I would then begin checking using statements, project configuration properties (right click project in solution explorer/properties), web config settings, includes, references and all included library versions. You should be able to figure this out by following those steps. I would be willing to bet that it is something nominal like a missing app or web config setting. Things of that nature can be difficult to detect without a working example project or proper instructions.
See this microsoft.com tutorial, although its not for the same version of visual studio, it may have some information that can lead you in the right direction.
Microsft.com Browser Link tutorial

Missing App_global.asax.compiled on target machine

I have several MVC4 applications, that when published via a Web Deploy, they don't always write the two files bin\App_global.asax.compiled and bin\App_global.asax.dll. If I publish multiple times it eventually will publish this file.
Without the files the route tables aren't built, and I get a 403.14 error when trying to access any controller functions.
I have this problem in both VS2012 Ultimate Update 4 and VS2013 Ultimate Update 1.
If I run the Publish preview it will generally tell me that it is going to delete both of these files, and if I refresh the preview it will change from delete for those two files to Update.
I faced this problem of missing App_global.asax.compiled and App_global.asax.dll when precompiling an MVC project.
First I thought it had something to do with TeamCity, because it would only fail when building under TeamCity, and not locally (from Visual Studio) or from the Command Prompt on the build server using msbuild.exe.
Turned out to be disk compression turned on for the disk where TeamCity was writing to. Found the pointer to the solution in the comment by Erik Ropez at http://ydie22.blogspot.ch/2008/11/aspnetcompiler-and-missing-compiled.html . Posting here as reference... So, if "Compress this drive to save disk space" is ticked, under Properties for the HardDrive/Directory, try turning it off.
Similar issue I just solved myself.
StackOverflow,
Just wanted to let everyone know that my problem was solved.
This was an issue with a virus scanner scanning the newly created temp directory for precompiling and actually locking the files in question.
So if anyone has issues such as this and is running any antivirus (especially enterprise level):
TLDR:
Check if your antivirus is locking files.
Turn off all compsec scanning utilities and turn on one by one to isolate which is causing problems.
-Burt Beezy

CSLA Project Tracker 4.5.30 - cannot login

I'm trying to get the 4.5.30 Project Tracker sample working in Visual Studio 2013. What I'm stuck with is logging in, it doesn't work for me in any of the projects (WfUI, WpfUI or Mvc3UI).
The actual issue is that the call to Membership.ValidateUser() is returning false in ProjectTracker.DalEf.UserDal - what would cause that?
I can attach to (localdb)\11 and see the aspnetdb database fine in the Server Explorer in Visual Studio and I'm returning data ok from the actual ProjectTracker database as I can see the read only project lists, resource lists, etc.
I can also create and login to new WebApplication projects created from VS2010 and VS2013 fine.
Quick steps to reproduce: Open the ProjectTracker sample in VS2013, unload the Mvc3UI project, set the WfUI project as the startup project, run it and try and login.
Solved it, and it is a corker. I thought I had tried everything, but then I checked the databases on (localdb)\v11.0 in SQL Management Studio, and discovered they were readonly... and then the penny dropped.... the samples are installed in Program Files by the 4.5.30 installer. As soon as I granted the Users group on my PC write full priveleges to the samples directory it all worked fine.
Edit: Thinking about this logically, the issue must be that the user account SQL Express is running in doesn't have permissions to write to Program Files.
Absolutely no indication of anything like that in the error messages returned by any part of .net of course. Hopefully the above will save others some pain.
Edit 2: I have now fully documented everything I did to ProjectTracker running in VS2013 here: http://forums.lhotka.net/forums/t/12200.aspx.

Visual Studio 'Publish' command fails

I'm working on a moderately sized WebForms project. Due to the peculiarities of management here, I have to upload the site to a remote server in order to test (no localhost testing). I'm using the 'Publish' command in Visual Studio 2008. Sometimes, it even works. Most of the time, I inexplicably get a "publish failed" in the bottom left corner, with no further details.
The few googled articles/forum posts I read suggested making the target local folder for the publish operation readable/writable for everyone. Doesn't help.
Is there are way to get further details as to WHY a publish fails in VS2008, and if not, is there a better way of doing these deployments? I'm spending more time building/pushing to the web server than actually debugging.
It's worth checking the output window. I've just had a publish fail because I had deleted an image outside of VS so VS was complaining that the image couldn't be found, but this information was only displayed in the output window.
See this link for more information:
http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/
It happens to us when there is an error in markup (!). Bad thing is that VS will just swallow the error and just tell you Failed.
What I suggest is to run your publish from command line using MSBuild. It's not that straightforward but it works (once you get into it).
I've since discovered that the reason for these particular publish failures was due the "Delete Existing Files" option being checked. Using Visual Studio 2008 under a non-administrative account on Windows Vista could cause a permissions error while attempting to delete the existing files. The publish would fail silently after encountering a file that Visual Studio had insufficient access to delete. Once the files were deleted manually outside of Vidual Studio, the publish functioned normally.
I have not had this issue with Windows 7; I assume the UAC changes in Windows 7 fixed the problem.
I mostly work with Web Forms, and I encounter this problem daily.
It seems to me that publish fails when it fails to delete a file it is trying to replace. Even if I don't have any files open, it still fails sometimes. Not sure why.
Not only VS publish fails very often, it is painfully slow as well.
I just publish to empty local directory and use separate FTP client to upload files. It's more work, but works.
This is probably not the case for you, but I've seen this happen when I'm publishing a web site. If the app_offline.htm file is not excluded from your project (if you use this file), the publish will fail.
Same happened to me.. what I did was include images files that was not included in the project and delete images that were not used.
After struggling with a similar issue for about 30 mins with no clue as to what was causing it closed down VS and reopened my project. Started working fine. No idea why but it worked.
You should always stop the IIS instance running on the machine your are publishing to. Google the word "iisreset". Other hosting providers like DiscountAsp and Arvixe offer you tools to "Stop" and "Start" your app pool on their IIS remotely. This is very necessary because IIS may have locked some files as "in use", so your publish fails when it tries to write over them. When your publish is complete, then just restart IIS (or press "Start" from a web tool if you're using a 3rd party hosting provider).
When all else fails, check your "Output" window (the tab to the right of your "Error List" at the bottom of Visual Studio). Scroll through all of it after a failed publish and look for anything that says "Unable to add". If you keep seeing the same "Unable to add" errors on the same publish, then ftp into the folder, delete the the problematic files manually, and try publishing again.
I got this when my ProjectName.Publish.xml file was read-only. Once I checked the file out of source control, I no longer got the error and could publish.
Just to add to this thread, I found that, for some bizarre reason, only the Mercurial files were being published to the server, everything else just wasn't being copied across.
Another strange thing was that only the Debug configuration was available; Release was nowhere to be seen.
After reading other threads around S.O., I found that there were many for VS 2010 and 2012, but not much to cover the same problem with 2008.
The fix, I found, was to delete the [solution].suo file and then attempt a publish. That seemed to do the job, though it took a long time to complete.
What I found and work in my case. It is to use a different version of VS.
I recently had the problem, the solution works perfectly in VS2015 build, compile and tested.
However, when I try to publish was failing silently.
So, I closed the solution and open it with VS2017 that use the same file structure for the projects/solutions. Then rebuild it and publish without any problems.
I believe it could be VS related and it is complicated to debug.
This is a workaround if you work with multiple Vs instances in your local machine.

Categories