Recently I joined a new website hosting provider who supported WebMatrix and MVC. After I used Web Deploy to upload my working files to the server, I got 404 errors on some of the pages. After some investigation I realized that I had to specify the full cshtml file extension on all links. After doing some research, Rick Strahl once again saved my life. In his blog entry, he explained that the following line of code must be added to web.config, if hosted on IIS 7, for routing to work.
Who would have thought of that?
The following example demonstrates how to disable anonymous authentication in IIS, and enable windows authentication.
using (ServerManager serverManager = new ServerManager())
Microsoft.Web.Administration.Configuration config = serverManager.GetApplicationHostConfiguration();
Microsoft.Web.Administration.ConfigurationSection anonymousAuthenticationSection = config.GetSection
("system.webServer/security/authentication/anonymousAuthentication", webSiteName + "/" + applicationName);
anonymousAuthenticationSection["enabled"] = false;
Microsoft.Web.Administration.ConfigurationSection windowsAuthenticationSection = config.GetSection
("system.webServer/security/authentication/windowsAuthentication", webSiteName + "/" + applicationName);
windowsAuthenticationSection["enabled"] = true;
I had a phone app that worked great using PhoneGap 1.0 on iOS4. Then after I upgraded XCode and PhoneGap to work with iOS5, my data service URL and Bing maps would no longer connect. It turned out that in PhoneGap.plist, I had to register any external links under external hosts. I also had to allow all whitelist URLs to show in the WebView control, which is under another property. Since I wanted to allow any external link to work, I simply added “*” to my external hosts.
In our setup program, we have recently changed to use vsdbcmd to deploy our dbschema file. I followed the steps in this Microsoft MSDN article on how to deploy vsdbcmd.exe on a machine that doesn’t have Visual Studio installed. However, I kept getting the follow error when I tested the program on a non-developer machine: An unexpected failure occurred: An attempt was made to load a program with an in correct format. (Exception from HRESULT: 0x8007000B). After doing some research, I got it working by following the instructions in this blog article. Basically, you do not need to copy any of the SQL CE libraries or the BatchParser library. Simply copy all the Visual Studio files listed in the MSDN article, then install SQL SMO and SQL Compact on the machine where you run vsdbcmd. That should work.
In my setup program, I was calling vsdbcmd.exe, a very wonderful database tool from Microsoft, to deploy my dbschema file in C#. I used a System.Diagnostics.Process object to invoke the tool, as I’ve always done with calling command-line utilities. And as always, I redirected the process’s output and error so I could display them in my setup log file. Unexpectedly this did not work. My program was hanging, still alive, but hanging. The database was created half way, and vsdbcmd.exe was still live in task manager. However there was no CPU activities from vsdbcmd.exe. After a bunch of experiments, I found out that redirecting the process’ output was the cause of the blockage. Redirecting error was okay. Gah why can’t vsdbcmd.exe work like all the other programs?
If you get this message during compilation, right click on the solution and select Configuration Manager. For the build configuration you have selected, check the box of the project that compiler complained about.
Okay, so there is a SQLCMD Mode for the query window in Management Studio for SQL Server. However, what I didn’t know was that there is also a SQLCMD Mode for the Transact-SQL Editor in Visual Studio 2010. Apparently, in order to compile any SQLCMD syntax inside of a script, such as the post deployment script for a database project, you must have SQLCMD turned on to avoid any parser errors. Cheers!
When I was migrating our TFS build to .NET Framework 4.0 from 3.5 SP1, I got the following error.
error MSB4062: The “xxx” task could not be loaded from the assembly xxx.dll. Could not load file or assembly ‘file:///xxx.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.
To resolve this error, you’d have to change the full path to the directory of MSBuild.exe in the TFS build service configuration file.
- Stop the Visual Studio Team Foundation Build service.
- Open the file C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config.
- Set the path for the new .NET Framework in the MSBuildPath setting:
<add key="MSBuildPath" value="C:\Windows\Microsoft.NET\Framework\v4.0.30319" />
- Start the service.
Today I migrated our Visual Studio 2008 solution to Visual Studio 2010, and I started getting the following error when I kicked off a TFS build.
“The working folder [/source] is already in use by the workspace [workspace name];[owner] on computer [tfs server].”
After some research, it turned out that I just needed to run a command to clear the workspace cache.
tf workspace /delete /server:[tfs server] [workspace name];[owner]
Not too bad. :)