14
votes

Error: a specified communication resource (port) is already in use by another application

  • This happens only on the Hyper-V emulator, old, 7.1 emulator works fine.
  • Deployment from Blend 2012 works fine.
  • Deleting the virtual machines in Hyper-V manager doesn't help
  • Deleting the %user%\AppData\Local\Microsoft\Phone Tools\CoreCon doesn't help

My output is:

1>------ Deploy started: Project: Proj1, Configuration: Debug Any CPU ------
1>Deploying C:\Users\Валентин\Projects\Proj1\Bin\Debug\Proj1.xap...
1>Connecting to Emulator WVGA 512MB...
1>The application is already installed on the device. Checking if an incremental deployment is possible...
1>Doing incremental deployment...
1>Updating information related to modified files...
1>Deployment of C:\Users\Валентин\Projects\Proj1\Bin\Debug\Proj1.xap succeeded.
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

Last status bar message:

Launching TaskHost.exe failed 

I'm using VS2012 express for WP, WP 7.1 project on WP8 emulator, Windows 8 64 bit.

The curious part is that it worked fine earlier, but for some reason stopped working today.

Please share your ideas.

11

11 Answers

8
votes

I had this occurring when trying to debug the app on my device. I fixed it by uninstalling the app and redeploying it.

7
votes

There is a workaround:

Right click on your project and select Deploy. This will copy all necessary code to the emulator. After that you are free to hit F5 like normal.

enter image description here


Original article http://blog.masterdevs.com/a-specified-communication-resource-port-is-already-in-use-by-another-application/. Thanks Josh.

2
votes

I was getting this same error and coundn't figure out why. I stumbled upon this solution (see link below) and remember that I had changed my namespace and that was the issue.

If you go into your csproj file, make sure this has changed.

<SilverlightAppEntry>TheOldNamespace.App</SilverlightAppEntry>

Reference :

Windows Phone 7 - App doesn't start, no errors, just bails on load

2
votes

I tried the other answers without luck, what it solved to me was deploying the application (right click on the project -> deploy) on the device or emulator, after that port was free again to enable debug.

1
votes

Run XdeCleanup.exe, and try restart your computer as well. Usually does the trick around here.

1
votes

I had the same problem, decided to try it: If You have an account Microsoft contains Russian name and a surname, then you need to switch to a local account containing English letters, run under it VS and then debug an application is running, then you can return to your account Microsoft and debugging will also work.

1
votes

This always happens the first time I launch the debugger and startup the Windows Phone emulator. Here are the steps I follow to get around this.

1) Start the debugger and let it launch the emulator 2) It times out (usually) 3) Close the emulator 4) Start the debugger again and let it re-launch the emulator

For some reason the first time it launches it can never connect for me.

0
votes

This is solved very easily.

    Microsoft.Phone.Controls.Toolkit.dll file add in the Service Refrence folder.
    Then In project right click on "sevice refernce" folder > include in project.
    rebuild the project

Run the project successfully

0
votes

In my case all above solutions didn't work.

So, what I did to solve my same problem: I manually deleted the Bin and obj folder from my Project which is automatically generated on every project build. I rebuilt the solution and deployed it to Emulator. This solved my problem.

0
votes

I had the same problem and it turned out to be an issue with the network connection. Try to launch the debug session with your machine being disconnected from any network.

0
votes

Well, i too had the same Error: a specified communication resource (port) is already in use by another application and i tried this, it works for me.

You just open the Project.sln file in Blend for visual studio. Go to menu>project>Run project !!! It installs the Xap file to your mobile without any error.