"Publishing Failed" for an Azure Function

Fixing the error “Web Deploy cannot modify the file on the Destination because it is locked by an external process.”

Reading Time: 4 minutes. This post describes how to fix the error, where when publishing Azure Functions or Azure App Services you get an error like this: “Web Deploy cannot modify the file on the Destination because it is locked by an external process.” This is luckily another straightforward fix!  Problem Azure Function Publish fails with a message: “Web Deploy cannot modify the file on the Destination because it is locked by an external process.” It is, indeed, caused by some of your files at the target of your publishing being in use, so they cannot be overwritten. Great – an actually accurate error message! Much […]

Microsoft Azure logo

Solving Azure Web Application’s first load perfomance issues

Reading Time: 3 minutes. Is your Azure Web Application suffering from absolutely horrible load times every time someone accesses it for the first time every 15 minutes or so? Mine was. It was pitiful. I was developing a web-based service using EF6 and ASP.NET MVC 5, where all the assets were hosted in the Azure. Even though the app was reasonably lightweight and usually responded very fast, the first time someone accessed it in a while it took 20-60 seconds to load AND sometimes even timed out (especially with mobile clients). Load testing revealed only the what I already knew: initial load times were […]

Visual Studio logo

Fixing the “Could not load file or assembly … or one of its dependencies” error

Reading Time: 2 minutes. This post describes how to fix the “Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error.  Problem Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception: Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format. No fear, though, as this is usually easily fixed. In quite a few cases, it’s simply a mismatch between architectures […]

Connect-MsolService

Getting Connect-MsolService (and other Azure Active Directory PowerShell cmdlets) to work

Reading Time: 10 minutes. In this post, I’ll try to archive everything you need to download and install to get commandlets like Connect-MsolService working. I’ve had to do it a couple of times when changing laptops, so it’s good to document them somewhere! 🙂 So, when would you need to follow this guide and install the modules described here? Mostly this comes to play, when you’re switching machines, try to run the SharePoint Online Management shell but it doesn’t even exist on the machine, or it does exist but you get random errors like this: The term ‘Connect-MsolService’ is not recognized as the name […]

Delete site collection

Remove-SPODeletedSite – Actually removing a SharePoint Online Site Collection

Reading Time: 3 minutes. This post describes the actual, working and fast process of removing a site collection in SharePoint Online using the Remove-SPODeletedSite commandlet in SharePoint Online Management Shell (a flavor of PowerShell). Description Sometimes you need to get rid of a site collection you’ve created in SharePoint Online. The most typical example perhap being removing the team site created for a group of people working together. That’s pretty simple and there are a few ways of doing that. For example, you might just go ahead, and delete the site from Site Settings (see below). Or maybe you’re a smart admin, and you go and […]

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

Reading Time: 3 minutes. This post describes how to run Entity Framework’s code-first migrations against a database located in the Windows Azure. This is done by running Update-Database commandlet with suitable switches, see below. The problem and symptoms Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re using code-first migrations. Cool! What’s nice with code-first-migrations is the fact they are run automatically even in the cloud the next time your app is running (as long as you publish your app with that little box ticked – something like in the screen capture below). But wait – what […]

IIS8

Exception of type ‘System.OutOfMemoryException’ was thrown.

Reading Time: 2 minutes. This post describes one of the more no-brainerish ways of fixing a ‘System.OutOfMemoryException’ exceptions being thrown in your MVC ASP.Net application using Entity Framework. Problem While developing a web project, for example ASP.NET MVC with EF, sometimes when handling a lot of data or complex entities on your dev machine, you encounter this error: OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.] System.Text.StringBuilder.ToString() +35 System.IO.StreamReader.ReadToEnd() +123 System.Web.Optimization.BundleFile.ApplyTransforms() +74 System.Web.Optimization.DefaultBundleBuilder.BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable`1 files) +472 System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +127 System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +45 System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +166 System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets) +205 System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths) +35 System.Web.Optimization.Scripts.RenderFormat(String tagFormat, String[] paths) +107 System.Web.Optimization.Scripts.Render(String[] paths) +21 Reason […]

Spatial SQL types

Solving the “Spatial types and functions are not available …” -problem

Reading Time: 3 minutes. This page describes mutiple ways on how to fix the exception ‘Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.‘ which comes up during debugging or publishing your program, app or service using DbGeography. Symptoms While running a console program or perhaps installing an ASP.NET MVC website on a machine, where SQL Server (apart from the one that comes with the Visual Studio) has not been installed, you may encounter the following error: Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version […]

Stock photo from pixabay.com

Using PowerShell to set ULS logging level to “extra verbose” to catch all the events in the logs

Reading Time: 3 minutes. This blog post describes how set the SharePoint’s ULS level to “Extra Verbose” (VerboseEx) using PowerShell. This is not possible using the browser UI, so some POSH magic is required! Luckily, it’s quite straightforward, but to avoid filling your hard drive(s) with huge log files, you should reset the level when you’re done debugging! Description of the solution By default, ULS logging is somewhat non-detailed. This means that a lot of data that could be used to debug issues is omitted. The UI cannot be used to set this level of logging to “Extra Verbose” – it is limited to […]

Anonymous access in SharePoint 2013

Using PowerShell to modify anonymous access permissions on SharePoint On-Premises

Reading Time: 2 minutes. This post is about managing Anonymous Access on a SharePoint site (SPWeb) using PowerShell commandlets. It’s often a lot more feasible and even easier than using the browser interface! In some cases, it’s borderline impossible to avoid it anyway – since accessing the GUI switch might not be possible. Description Assume you have a site collection that’s you have published to the whole world. You’ll have anonymous access enabled at both web application and site collection -levels, and configured permissions at the root web -level. Now, let’s assume you want to disable anonymous access on a certain site deeper in […]

Powershell: languagepack 0

Powershell Error: Cannot uninstall the LanguagePack 0 because it is not deployed.

Reading Time: 2 minutes. Have you ever run into this, very non-descriptive and weird SharePoint error message “Cannot uninstall the LanguagePack 0 because it is not deployed”? You could encounter it while running some PowerShell scripts – most typically, when trying to update a wsp solution. I have, and luckily often easily solved! Symptoms Assume you’re trying to install, update or uninstall a SharePoint solution (.wsp package) using PowerShell-commands Install-SPSolution, Update-SPSolution or Uninstall-SPSolution (respectively). Operation fails with the following (or similar) error: Error: Cannot uninstall the LanguagePack 0 because it is not deployed I have actually seen this also in the form of “Cannot uninstall […]

Malformed web.config causing a Parser Error

“Server Error in ‘/’ Application” or “Parser Error” – it’s actually a malformed web.config killing your ASP.NET-application or SharePoint

Reading Time: 2 minutes. This post describes how to resolve a kind of cryptic and oddly misdescriptive error message about Parser Error on your ASP.NET application or (an On-Premises) SharePoint site. I ran into this after deploying wsp-packages to a SharePoint farm, but you can apparently get this on ASP.NET MVC sites, too. The error doesn’t actually tell you what’s wrong, so figuring it out took a while. Hopefully it’ll help you, though! Symptoms: Parser Error from a random-looking location Once you navigate to your web- or SharePoint site, you only get an error like this: Server Error in ‘/’ Application. Parser Error Description: An error […]

SharePoint project properties

Visual Studio 2010 fails to show the design view of an aspx-page

Reading Time: 2 minutes. This post is about solving the issue with Visual Studio 2010 failing to show the design view of an .aspx-page. Luckily, it’s an easy and pretty classical fix. Symptoms While trying to view or edit an aspx-page in design mode in Visual Studio 2010, the window is just plain empty and there’s little you can do about it – selecting view markup or hitting F7 may not do anything and restarting the Visual Studio doesn’t help. Solution The Design view requires connection to the SharePoint site where you’ll be deploying the solution (or rather, any site). Set the Site URL […]

Too long deployment path

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Reading Time: 3 minutes. This post describes a few different ways of fixing the error “The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.” one can get when trying to package/publish a SharePoint solution, web site or Azure Webjob. UPDATE 11.4.2016: I actually got this nasty exception on another occasion (Azure webjob publish), so I updated the text accordingly. Symptoms Visual Studio throws the following error when packaging a SharePoint solution to a .wsp file, OR when deploying or publishing your web project (for […]

IE11 compatibility view emulator

Identifying IE11 compatibility mode in SharePoint

Reading Time: 4 minutes. In this post, I describe how you can figure out if IE11 has jumped in the compatibility mode. This is quite important because in compatibility mode IE does its best to screw up your CSS. Compatibility view now and before Microsoft has been pretty keen on introducing new ways to handle browser compatibility and make IE behave in even stranger ways that it usually does by switching it to compatibility mode. There are a few reasons this could happen. In SharePoint’s case, perhaps the most usual one is that IE identifies the SharePoint site to be located in intranet zone… Or […]

Stock photo from pixabay.com

Simplest way to create a thread on SharePoint

Reading Time: 2 minutes. This post describes the (probably) easiest and most straightforward way of creating a new Thread in your SharePoint (or any other .NET) server-side / desktop code. Solution: how to create a new Thread Let’s face it – one should not create new Threads lightly when developing SharePoint solutions, but sometimes it’s difficult to avoid. Or sometimes it’s just the simplest way to get around weird framework limitations. Posts Related to “Simplest way to create a thread on SharePoint”:Programmatically creating readable internal names for new SharePoint fieldsSharePoint Localization – a (somewhat) comprehensive how-to!Fixing an unhandled exception about StructureMap configuration failing (messed […]

File not found

“File not found”-error when trying to activate custom feature on SharePoint

Reading Time: 2 minutes. This post is about fixing on of the most non-spesific errors you can get when activating features on SharePoint “File not found”. Problem “File not found” is one of the more annoying errors one can stumble upon when trying to activate a feature. There are quite a few reasons that can cause this error, but after the obvious ones (some files failing to be included in the package, botched wsp deployment, errorenous urls in event receiver) one thing to check might be the alternate access mappings. Posts Related to “”File not found”-error when trying to activate custom feature on SharePoint”:Getting Connect-MsolService […]

Visual Studio's Attach to Process -dialog

Attaching the Visual Studio debugger to the right IIS worker process

Reading Time: 2 minutes. Every now and then comes the time when you’d actually need to debug something, and then you’ll likely be using your Visual Studio to attach the debugger to one or more processes. Using CKSDev to attach to all IIS worker processes (w3wp.exe), or if you don’t use CKSDev, just pressing ctrl+p and selecting the processes from the list, is often a good enough solution. However, sometimes that makes your dev box sluggish, or maybe catches exceptions from code you’re not wishing to debug at the time, and it’d be handier to just attach to the one process you actually need. […]

Troubleshooting guide for Windows hosts -file

Reading Time: 4 minutes. This post describes how to fix possible issues with Windows hosts-file. I’ll first document how to find the damn file, and then go through a bunch of options on what to check and how to fix different possible issues. Opening the hosts -file First of all, hosts file location is usually: C:\Windows\System32\drivers\etc\hosts (link may or may not work depending on your security settings and browser version, but you can always copy-paste it to your text editor’s “Open”-dialog… 🙂 Editing the file requires elevated privileges for the text editor process, so you’ll need to run it as an administrator. Posts Related […]