MSDeploy/TeamCity: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

clock April 20, 2012 13:48 by author Frederik Schøning |

Problem

In a TeamCity CI setup using MSDeploy for packaging and deployment, I started getting the following error:

 

[12:44:05]_build\build.xml.teamcity: Build target: Deploy (39s)
[12:44:05][_build\build.xml.teamcity] Deploy (39s)
[12:44:43][Deploy] CallTarget (1s)
[12:44:43][CallTarget] CleanSitecoreDeploy (1s)
[12:44:43][CleanSitecoreDeploy] Exec (1s)
[12:44:44][Exec] EXEC error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
[12:44:44][Exec] Error (503) Server Unavailable.
[12:44:44][Exec] EXEC error count: 1.
[12:44:44][Exec] D:\TeamCity\buildAgent\work\acbf438b080c752e\_build\build.xml(97, 3): error MSB3073: The command "".\MsDeploy\msdeploy.exe" -verb:sync -source:package="D:\TeamCity\buildAgent\work\acbf438b080c752e\_build\package\sc531CleanDeployPackage.zip" -dest:iisApp=dev.MYSITE.dk,computerName=localhost" exited with code -1.
[12:44:44][_build\build.xml.teamcity] Project _build\build.xml.teamcity failed.

Solution

Extremely simple. In my case, the Web Deploy service had stopped for an unapparent reason. I couldn't find a clue, though, in the event log other than that it just stopped. I will update here, if this continues, and I find a solution.

 



Solution: Cannot define a new extension method because the compiler required type 'System.Runtime.CompilerServices.ExtensionAttribute' cannot be found. Are you missing a reference to System.Core.dll?

clock January 26, 2012 15:41 by author Frederik Schøning |

Problem

You get either of the following 2 compile-errors:

  • Cannot define a new extension method because the compiler required type 'System.Runtime.CompilerServices.ExtensionAttribute' cannot be found. Are you missing a reference to System.Core.dll?
  • Cannot use 'this' modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove 'this' modifier from the method declaration.

What's probably the case

You defined an extension method in VS2010, but forgot, the project you're working on has to compile to ASP.NET v. 2.0.

What you should do

Chillax - you can fix it!

Solution

Create a file in your project called ExtensionAttribute.cs (or whatever, really) and paste the following into it:

 

namespace System.Runtime.CompilerServices
{
	public class ExtensionAttribute : Attribute { }
}

 

Hit F6!

References

Read here: http://www.danielmoth.com/Blog/Using-Extension-Methods-In-Fx-20-Projects.aspx



Google Chrome address-bar search not working

clock January 25, 2012 15:54 by author Frederik Schøning |

Problem

Today, when googeling through Chrome's address bar, Chrome suddenly started just redirecting me to Google instead w/o the search terms, just a blank google.com.

Solution

  1. Go to "Wrench" -> Options -> Basics -> Search. Change search engine dropdown to something else than google
  2. Open a new tab and do a search via the address bar
  3. Go back to the options-tab, change search engine dropdown back to Google
  4. This should work!

 



How to export/import vssettings (Visual Studio settings) into an older version (2005/2008/2010)

clock October 6, 2011 11:34 by author Frederik Schøning |

Problem

If you export your Visual Studio settings to yourFile.vssettings and try to import this file into an older version of Visual Studio, you will encounter the following error:

 

The file 'C:\Projects\Settings\SettingsFile_date.vssettings' was created with an unsupported version of this application and cannot be added to the settings file list.

Solution

Open the .vssettings-file in e.g. Notepad and change the following attribute:

 

<UserSettings>
	<ApplicationIdentity version="10.0"/>

-----lot's of stuff here...------

</UserSettings>

 

to the corresponding value of your Visual Studio version, which would be

Visual Studio 2008:

<ApplicationIdentity version="9.0"/>

Visual Studio 2005:

<ApplicationIdentity version="8.0"/>


Free profiler for MS SQL Server Express

clock August 18, 2011 12:47 by author Frederik Schøning |

I use the free MS SQL Server Express a lot for smaller projects and development, since it's free and fully featured. One thing, though, I always find myself missing from the free version is the SQL Server Profiler, which is only included in the paid version of MS SQL Server.

Today I stumbled upon the AnjLab Sql Profiler - a lightweight (4.1MB, quick install) profiler, that does exactly what I need, i.e. spoof the SQL, that is actually executed on the server; useful e.g. when using NHibernate or another Sql abstraction layer, where I find myself not always knowing what's going on underneath the hood.

 

And: you can actually sort your results by clicking on the columns for duration, reads, and so on - a thing I really never understood why you can't do with Microsoft's profiler.

 

It works with SQL Server Express v.9 (2005) and up.

 

Screenshots (stolen from Alternativeto.net)



FTP Publishing Service 7.5 is incompatible with IIS: FTP Server - how to uninstall the old FTP Service

clock June 22, 2011 13:10 by author Frederik Schøning |

Problem

I wanted to install the FTP Service 7.5 downloaded from IIS.NET, and got the following:

Obviously, you should uninstall the old FTP Service first. But how?

Solution

Is is a feature? Is it a role? No - it's a <blink>Role Service</blink>. To get to it, click Go to Roles and uncheck the thing.



FIX: Internet Explorer Cannot Open the Internet Site- Operation Aborted This program cannot display the webpage in IE7

clock May 16, 2011 15:11 by author Frederik Schøning |

As described here, this error most probably arises, when a script on your pages attempts to modify an element, that is not (yet) in the DOM or is a parent of the current element. Oh, and when viewed in IE7.

In my case, this error was triggered by trying to execute a jQuery extension-method, before the DOM was loaded. Or to cut directly to the chase: the call to the custom extension was not wrapped in the $(document).ready(function() { ... }) thingie.

So, instead of this:

$.fn.MyGreatFunction = function (args) {

//stuff here.............

};

$(".myElem").MyGreatFunction();

use this:

$.fn.MyGreatFunction = function (args) {

//no here, actually.............

};

$(document).ready(function () {

    $(".myElem").MyGreatFunction();

});

In general, you should never assume, that your DOM is ready by trying to bind any behaviour outside the $(document).ready block.



Installing Windows 7 in VHD on a clean/empty harddrive

clock May 7, 2011 14:22 by author Frederik Schøning |

Follow this guide:

http://blogs.msdn.com/b/knom/archive/2009/04/07/windows-7-vhd-boot-setup-guideline.aspx

Except:

between step 3 and step 4 - that is, if your disk is not initialized (you don't have a "C:" drive) - do approx. this:

 

  1. (...be in DISKPART....)
  2. SELECT DISK 0
  3. CREATE PARTITION PRIMARY
  4. ASSIGN LETTER=C
  5. SELECT PARTITION 1
  6. FORMAT FS=NTFS LABEL="Mofo-disk.." QUICK
Ofc you might want to choose another filesystem, label, partition type etc etc.


Gmail chooses MIME-type "text/plain" over MIME-type "text/html"

clock January 10, 2011 12:40 by author Frederik Schøning |

Problem

When sending out email through .NET, I sometimes use the MailMessage.AlternateViews collection to offer email-clients to choose between an html- and a plain-text-version of the message.

However, recently I found a problem, where - when providing these 2 options for the receiving client - Gmail would always choose the plain-text version, although Gmail most certainly can display html.

Solution

It seems, that Gmail will always choose the latter of the 2 options (in this case only? I don't know), so you should simply add the AlternateView with MIME-type "text/plain" before the "text/html" one.

References

http://www.bennadel.com/blog/188-GMail-Chooses-ONLY-Non-HTML-Mail-If-Given-The-Option.htm (Tim-dude in comment)

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/2b22fdbe-af6d-4c90-ae30-3c8b109c0818 (Franklin Neves in comment)



HtmlEncode / HtmlDecode without HttpContext

clock January 10, 2011 12:09 by author Frederik Schøning |

Instead of

var decoded = System.Web.HttpContext.Current.Server.HtmlDecode(textToDecode);
var encoded = System.Web.HttpContext.Current.Server.HtmlEncode(textToEncode);

use

var decoded = System.Web.HttpUtility.HtmlDecode(textToDecode);
var encoded = System.Web.HttpUtility.HtmlEncode(textToEncode);


How to install ASPSmartUpload on Windows 7 / Vista / Server 2008

clock November 16, 2010 15:46 by author Frederik Schøning |

This component seems to be outdated/legacy, but for a customer, I needed to port some code, that used the component.

Which is - in fact - possible. Only a bit undocumented, so here goes:
  • Get the component (google it or try here: http://stackoverflow.com/questions/45534/aspsmartupload-v3-2)
    • it has 2 files:
      • aspSmartUpload.dll
      • aspSmartUploadUtil.dll
    • put the files in a folder outside the c:\windows\ folder or subfolders.
    • Reportedly, if you don't do so, you will get the error "module cannot be loaded" or "specific module could not be found".
  • Move aspSmartUploadUtil.dll to C:\Windows\SysWOW64 (depending on your Windows folder name)
  • Open a command prompt as administrator
    • if your command prompt is not opened as administrator, you will get the following error:
      • “The Call to DllRegisterServer Failed with Error Code 0×80004005”
  • Go to the folder with aspSmartUpload.dll
  • Type ‘regsvr32 aspSmartUpload.dll’
  • Hit Enter
  • You should be ready to go!


Missing IPV4 address and domain restrictions in IIS7

clock October 26, 2010 23:03 by author Frederik Schøning |

Download the WebPlatFormInstaller, run it and choose Web Platform (pane) > Security (bottom) > IP and Domain Restrictions. Restart your IIS Manager, and the feature should be there!

http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx



Attach database failed for Server [...] Unable to open the physical file "[...]". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)

clock June 30, 2010 01:41 by author Frederik Schøning |

Problem

- bummer. This is some permission issue. It seemed, 2 things can cause this error:

  1. trying to attach an mdf-file, that has not been detached (properly)
  2. some other stuff, which was my case. Never found out what (as I did, indeed, detach this database first)

What I tried first

  • Moving mdf- and log-files to somewhere else, retry -> fail
  • trying to give my SQLSERVER/SQLEXPRESS service(s) modify-permissions on my DB-folder. The use NETWORK_SERVICE as default. This caused, btw, an error, when applying the modify-rights to the individual (db-)files in the folder. Oh: -> fail
  • Cursing, random rebooting. Lots of that kind of stuff

Solution

1 hour of googling and uber-fail led me to somewhere (i closed the tab - sorry for the missing reference), suggesting running the Management Studio Instance as an administrator. Guess what: WIN!



OpenX 2.8.2 missing statistics - and solution

clock April 26, 2010 23:51 by author Frederik Schøning |

------------------------------------------------

UPDATE 25/11-2010:

You should upgrade to 2.8.7 (even if using 2.8.5) asap. You can download it here: http://download.openx.org/openx-2.8.7.zip.

The 2.8.5 has some serious security-holes, that could lead to cross-site script-injections (and even worse stuff). I know -- since the installation, I was working with (2.8.5), was - in fact - compromised. If 25/11-2010 is a long time ago, you might check http://openx.org/ for an even more recent version.

------------------------------------------------

 

(Scroll down for the no-bull solution)

On a site, I'm working on, the statistics page in the administration-section of an OpenX-installation (2.8.2 on php/IIS, Windows Server 2008) a few weeks ago stopped displaying anyting. It looked like this:

 

 

- which sucked. So I asked google and tried a number of possible solutions, like e.g.:

 

  • upgrading OpenX to latest version, as of writing this blogpost ver. 2.8.5 2.8.7
  • traversing log-files, looking for possible damaged MySQL tables and the like
  • executing "repair" on all MySQL tables, just because, hey...
  • drank some wine, went to bed, woke up, yelled at my laptop
  • googled some more
So, here's what I think happened. 
I found the following in the debug log (/var/debug.log):
Automatic Maintenance Task not run: could not acquire lock
- and then in the user log in the app itself (and this looked quite serious), something like Installer inserted user "adm" (#57).
Now, I'm not certain of this - some ppl think, it has to do with some security-style exploit in the php-code, that at least in 2.8.2 was present (I'm actually not even sure, if this supposed hole has been patched as of writing this post It has now as of 2.8.7 (25/11-2010)). Anyhow, I discovered that the /www/admin/install.php had not been deleted from my installation in question, which the setup-instructions do clearly state, btw, you should do. So my theory was, that someone (script, monkey, chinese haxor) had re-run the installation-script, creating a (duplicate) administrator-account, and that this would mess up everything.
As it turned out, a duplicate administrator-account had in fact been created. And having duplicate administrator-accounts seems to really suck in OpenX - so:

Solution

(I'm assuming, you know how to execute SQL on a MySQL server instance. Otherwise, you should really call someone now, who does)

 

  1. Delete a possible duplicate administrator-account from the "ox_accounts" table. It will have an account_type with value ADMIN. The one you want to delete, is most likely the one with the higher ID. Your "real" admin-account will probably have id = 1, as this is the first account that is created upon installation. But: please check.
  2. Goto table "ox_application_variable" and set the value of the variable "admin_account_id" to that of your primary (and only!) administrator-account (most likely '1', see above). The SQL for this would be "update ox_application_variable set value = 1 where name ='admin_account_id';"
This did the trick for me - the stats are back! One could wonder, why the rest of the OpenX instance except the statistics works fine, even though it's basically been compromised. I choose to close the case here.

 

Kudos to the Greg-guy in this thread:

http://forum.openx.org/index.php?showtopic=503470661

 

NB: There might be other reasons as to why the stats might not show in OpenX. If you run into some other possible solutions, feel free to drop a link in the comments. Thank you.



Hello world

clock March 19, 2010 01:07 by author Frederik Schøning |

Blog up!