It has been a while since I've published my app to Azure. During that time frame, I've upgraded my system from 32-bit to 64-bit meaning a fresh install of Windows and Visual Studio. And Visual Studio Update 3 came out and was applied. When I went to publish an update today, I received the following:
The following exception was thrown trying to publish: Root element is missing.
My web.config file looks fine so I don't think it's this issue.
The app works fine in debug mode so I don't think it's any of the .lsml files as is mentioned here.
And I tried this procedure to hand edit the .ls3proj file but it didn't seem to help.
I previously had an issue trying to publish when I upgraded from the standalone LightSwitch 2011 to Visual Studio 2012. I was able to overcome that issue using the method described in this thread.
Attempting to use this same method resulted in my new project has a full screen error saying "There are critical errors in the application definition metadata..." and 210 individual errors (max errors reached).
The first error, "Cannot create unknown type '{http://schemas.microsoft.com/LightSwitch/2010/xaml/model}GlobalAttributeGroup'." Doesn't make sense because that line in the .lsml is identical from the old project to the new project.
The second error, "Could not find any application definition in the project." Which I do not understand at all.
I am able to publish a simple "Hello, world" style app to my Azure account.
What could be causing this? How can I get more information about exactly which element is causing the issue? The log produced by running devenv /log was not helpful.
Matt Thalman was able to solve my problem over in the Microsoft Forums. The ServiceConfiguration.cscfg and ServiceDefinition.csdef were missing from the project when checked out of version control. Copying those over from a new project restored my ability to publish.
Related
Update: this bug has been fixed for a while now
I installed Visual Studio 2017.3 yesterday and was trying to used the new Development time IIS Support feature. I think I encountered a bug, and I was wondering if anyone knows a workaround this bug. When I used it with a new project it works fine most of the time. By most of the time, is that I think it is broken sometimes depending on the where the project is located/state of cached data, etc.
Sometimes I get an error "Value cannot be null. Parameter name: name". That's the entire error. No log files, no extra information.
I tried to enable the feature for an existing project I am working
on, it got that error.
I tried adding a new web project in a new solution it worked fine. I tried adding a new web project in the same solution as my project, it didn't work.
I deleted all temp files, all bin obj and .vs folders and .user files in the
solution. Same problem.
I deleted temp folder, visual studio user profile data, and restarted the PC same problem.
I tried again in the same solution with the project not having '.' in the name, it worked.
I did some modification to the project that was working and tried to launch again I got same error.
I reverted all changes so that the project was back to the "empty project" state, still same error.
I removed the project. Exited visual studio, deleted all temp/.vs/.use/bin/obj files. Then restarted and added the project again, it worked.
I restarted VS and tried to relaunch it didn't work.
The aspnet core version seems to be not related to the bug. I had the problem with projects targeting 1.1 and 2.0 and also had the feature working for both versions.
So obviously this is a bug in VS2017.3. Since even if I am doing something wrong I should at least get an error explaining what I do wrong not an ArgumentNullException message. I already made a bug report. I am wondering if someone knows a workaround thing bug.
Thanks a lot in advance.
Update: This bug has been fixed for a while now.
After some investigation and with help from a helpful member of Microsoft's Visual Studio Team, I found that Visual Studio was failing at the point where it grants folder read access to the IIS App Pool account. The method that gets the App Pool account name was returning null, and when that null value was passed to the System.Security.Principal.NTAccount class constructor, the ArgumentNullException is thrown.
A workaround that fixed the problem for me, was changing the App Pool to any other App Pool, trying to launch, then changing it back to the original/desired App Pool.
First You Must Update Visual studio with visual studio Installer and Launch the Visual Studio installer.
And Select the Development time IIS support component and Modify.
Wait For Download is Processing
The component is listed as optional in the Summary panel for the ASP.NET and web development workload.
Then you Create New Project Again
Problem Solved.
Crash on Azure publish from Visual Studio. The same thing happens in previous versions of Visual Studio, but in the past I've been able to work around the bug by clearing the appdata and if necessary resorting to resetting user settings per the responses to this question about a VS2015 issue.
Azure publish has been working up to now in 2017. Suddenly I am getting the dreaded null reference, and this time clearing the aforementioned data has not helped:
Restarted Visual Studio, restarted machine, cleared data a second time including both roaming and local appdata, all to no avail.
Just for others searching, in my case the issue was that I had previously disabled the "Microsoft VisualStudio Managed Publish" extension in VS2017 (probably in an attempt to get VS to be more responsive). To re-enable it, go to Tools > Extensions and Updates, enable it, then restart VS:
Thank you for your sharing. I have the same case as you. I accidently disabled the "Microsoft VisualStudio Managed Publish" extension in VS2017. The publish menu even doesn't show up in .net core solution explorer. To re-enable it, go to Tools > Extensions and Updates, enable it, then restart VS.
Unchecking/unselecting the Application Insights in the Publish workflow of Visual Studio 2017 fix the error for me.
This can be caused by a validation error in the service definition and configuration files.
Even though the editor doesn't highlight any problems, and the build completes successfully, there can be errors in these files and they are not handled properly when you attempt to publish, giving the null reference error.
I encountered this after modifying the files per these steps to configure SSL. I really wasn't expecting that to be the culprit, but in desperation I was trying everything I could think of that might be causing the problem. As soon as I commented out the change to the <certificates> element, the null reference error went away, and the publish succeeded.
(I now need to work out why the steps for SSL configuration didn't work, perhaps due to a change introduced by VS2017, but that's another story.)
I was experiencing the same issue as the OP. I created a new DB Project and then compared the settings of the new DB Project with the DB Project that was causing the Null Reference Exception upon Build or Publish. I noticed that our output directory was redirected to a non-standard location. After deleting all the files in the bin folder, the Build and Publish started working. YMMV
I found a lot of answers around that -- so may be there are more than one -- but none worked for me.
On my system it worked again after removing the installations for ASP.NET and Azure and installing it newly .. --> evth is fine.
I have been with VS2012 for a few years now. I developed my first asp.net/angularjs project under VS2012.
Secondly, I recently checked out a VS2013 project (written by a 3rd party) which ran just fine under 2012.
Then it was suggested that I install VS2015 on my laptop. This is when things went wrong.
Problems:
I attempted to load the new VS2013 project in VS2015, but it immediately failed to load.
VS2015 error:
Creation of the virtual directory http://localhost:32999/
failed with the error: Filename: redirection.config
Error: Cannot read configuration file
Now when I go back to VS2012 and load my original asp.net/angular project, I get this error:
So in the end, I can't load any projects at all ! Neither 2012 nor 2015.
My local IIS websites are still running fine, by the way, but not the local dev environments.
How can I fix these virtual directories ?
Thanks in advance,
Bob
As per some guidance from this post - IISExpress 8 Cannot read configuration file redirection.config, here's how I got my VS2015 to load up successfully:
Close VS2015
Go into folder %userprofile%\Documents\IISExpress\config
Rename applicationhost.config
Restart VS and load the solution/project
VS should have recreated applicationhost.config, and project should load
Of course, I now have a different error, which I will post anew:
[BadImageFormatException: Could not load file or assembly 'MyWebApp.DAL'
or one of its dependencies. An attempt was made
to load a program with an incorrect format.]
I resolved the same problem by starting visual studio with Administrator rights. This post pointed me in the right direction and gives more solutions.
This may be due to checked-in applicationhost file.
Delete the file from the repository. Build the project again. This file will be created automatically. Don't check in this config file again.
This won't work for everyone, but in my case, the file that couldn't be written was actually a temp file in C:\users\\AppData\Local\Temp\iisexpress. We were getting a company wide virus attack and they shut this area down for everyone. They were able to change the policy just for me and that fixed it.
Error message:
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.
This was the error message I got when I tried to launch Visual Studio 2012 on my Windows 8.1 system. There is no other information to act upon other than this, which is rather the same as "We don't know what's wrong. We will tell you if we know (but I don't think we do)". It was actually working before it just decided to stop.
The last configuration I made before it began to show this error was that I selected the option to load the last solution whenever I launch Visual Studio, and this was done in the options dialog. I don't think that could have caused Visual Studio to suddenly crash. The previous error message included something that had to with a change in configuration.
I have checked that ActivityLog.xml file in.
There were basically four errors:
Construction of frame content failed. Frame identifier: ST:0:0:{74946827-37a0-11d2-a273-00c04f8ef4ff} Frame caption: Exception details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage() at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()
SetSite failed for package [Visual Studio Component Model Host Package]
End package load [Visual Studio Component Model Host Package]
End package load [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]
I have searched on Stack Overflow, Bing and Google. The solutions I got from there didn't work. Some had to do with registry settings, deleting keys, etc. I even disabled all the extensions from the registry. There was a time it was showing another message that "Object reference was not set to ...".
I don't know what to do. The only solution I have not tried is the one that I should download the updates. Update 4 is about 2 GB. That will take me, at least a week to download. Is there anything I can do?
PS: I tried to uninstall it. It does absolutely nothing. From the Control Panel, there's only the option to change. Clicking it seems to do something but nothing appears. I tried running from the set up from the .iso file. It shows nothing, too. How can I fix this problem?
There's probably nothing we can help you with here, my view is that you need to reinstall VS. If you cannot uninstall or repair it then you should contact Microsoft.
I am able to fix this problem by installing latest version of of .NET Framework. May be helpful for others as well.
I am using Windows 8 and Visual Studio 2012 to run an ASP.NET web application locally. Problem is I can't figure out how to attach the debugger. I tried debug>start debugging but it gives me the following error...
I added a breakpoint in my code and tried starting/hitting site, but no dice. I also checked my project and ensured ASP.NET debugging was checked and confirmed the proper config in my web.xml.
Any ideas?
Update:
Ok I can attach to the process using the following....
But it still says my symbols have not been generated...
And when I try to connect to iisexpress instead I see...
You need to attach the debugger to iisexpress.exe. Although this worked for me it did throw up an error at first so my assumption is that it can just be ignored. I am marking this as the solution for now, however, if someone comes up with a better answer I will switch.
It looks like you are trying to start a library project and not an asp.net project.
Do you have more than one project in your solution? Try right clicking your project file and clicking 'set as start up project' and debugging it again.
If you only have the one project in your solution, or you are sure the right project is set as the start up project, then you probably created the wrong project type for it. Create an asp.net project and move your files over into that.
Make sure your project is a asp.net project. If it is, right click on the project and select "set as startup project", then try running it.