Debugging in VS2013 with WCF - c#

Due to recent hardware failure, I've had to go back to an old laptop of mine. I newly installed VS2013 on Win8 and am finding a new behavior. Used to be, when I would debug one of my Winforms projects, the other included WCF application projects would automatically launch to the
http://localhost:42898
(etc) address. Now, with this new install of VS2013, I can't get the IIS Express versions to launch when I'm debugging my other projects.
Does anyone know of how to configure VS to automatically build and launch these ancillary web apps during debugging of winform apps?

You are looking for multiple startup projects. Right click on your solution and select Properties -> Startup Project -> Multiple Startup Projects:
Now when you hit F5 both your WCF service and WinForms applications will start in Debug mode.

Related

How to deploy WCF Service with UWP Application?

I have a solution which works perfectly while debugging in Visual Studio, but will not run on the same machine if I deploy in release mode. I'm assuming it is because my WCF Library Service is not getting deployed and starting with it. It seems that it only runs in debug mode.
The solution is a UWP Application (version 1607), so not Fall Creator's update. I'm using WCF Library Service to pull data from a SQL Server into a net standard 1.3 pcl. In Visual Studio it works, but not when I click on the deployed UWP app.
Is there something I'm missing? I did see a comment about adding the WCF App.Config code to my launching app's APP.Config file, but a UWP app doesn't have one.
Any help would be greatly appreciated.
Thank you

Different dependencies when starting web application with "Always Start When Debugging"

I start my web application from Visual Studio (2013) using IIS express. If I set it as startup project and start it directly everything works fine.
In the project properties "Always Start When Debugging" is enabled, so the web app also starts when I start my web client in the same solution. But for some reason some dependencies in the webapp\bin directory are exchanged with different version (in this case the Newtonsoft.Json.dll is overwritten with a very old version).
Can someone please explain me the mechanism behind this functionality? Why is my webapp\bin directory touched when I start a different project?

How to debug a web service in a C#/.NET solution from a web application

I have an application solution consisting of eight projects in C#/.NET with Web services.
One of the projects is of web services.
All the data is fetched through the web services in a Windows Forms application.
But while debugging my Windows application I am unable to debug the web services called for fetching the data in Visual Studio 2010.
How do I debug a web services project in a solution when data fetching events are fired?
Normally, when debugging in Visual Studio the selected StartUp project will be executed in debug mode. In your case you need to start and debug both the Web API project as well as the WinForms project. You can do that by right-clicking in the solution explorer and selecting Set StartUp Projects. A dialog box opens where you can select Multiple startup projects and then select which projects to start when debugging the solution.
Another option is to have a single StartUp project (the Web API project as this is a requirement for the other project to run). You can then right-click on the WinForms project in the solution explorer and select Debug -> Start new instance. You can do this multiple times to debug multiple instances of the same project.
Obviously, you can always attach the debugger to any running process and if your Web API is deployed using IIS it will already be running. Using the procedure outlined above Visual Studio will attach to the right worker process.
You should attach Visual Studio to the host process of your web service.
This process is usually the IIS worker process which name is w3wp.exe on IIS 6+ on Windows Server 2003, Vista , later.
To attach to this process, you can use Debug -> Attach to Process in visual studio. Inside the Attach to process dialog box Make sure you've checked the Show processes from all users and also when selected your process, make sure that Managed code is selected. To select managed code click Select... and check the Managed Code checkbox (V2.0 or V4.5,4.0 depends on your selection of framework)
You can debug the web service by attaching the VS debugger to a process as follows:
Debug > Attach to Process > Attach
You can browse the available service that you are looking for and attach.
You can attach to the process of your web service. In Visual Studio, click menu Debug → Attach to process.
This writing is 2019, solution is to attach to IISExpress. Debug -> Attach -> find iisExpress (not the tray) in the list, .

Why is MVC Web Api only reachable when started in debug mode?

I am facing a strange problem on both my laptop and desktop computer.
In my solution I have an MVC 4 Web Api and the solution is started by Visual Studio 2013.
So If set the Web API project as startup project then When I type some url of the web api it hits the controller.
But if the startup folder is another project, like a website that consumes this web api, then the web api is just unreachable.
I even tried to hit the same url that works when web api is started in debug mode.
So, what could be wrong?
Most likely the issue is that web server is not running. Try hosting your web API in IIS with a fixed URL and port.
Or your try setting multiple start up projects like this:
In your Solution Explorer,
Select, Right click your solution.
On the Project menu, click Properties. The Solution Property Pages dialog box opens.
click Startup Project.
Click Multiple Startup Projects and set the project actions start.
Two possible ideas to try:
Left click on the WebApi project, and open the properties window (F4 for shortcut key) ensure Always Start When Debugging is set to true
When debugging your consumer application, right click on the WebApi Project, and click Debug > Start New Instance
If they don't work the best solution would be to host the WebApi application using IIS / IISExpress
I have found the actual problem.
I am running Windows 7 x64 and Visual Studio 2013.
I had to uncheck the Enable Edit and Continue checkbox under Tools->Options->Debugging.
Now I am using a single startup project in my solution and I can call the web api also when not in Debug mode.

Problems Installing a Windows Service from a Visual Studio Installer Project

The reason I ask is that I must be doing it incorrectly as I am having a lot of problems and I feel like I am chasing my tail here.
Using the how-to here, http://msdn.microsoft.com/en-us/library/zt39148a.aspx, and that works great.
So this windows service that I have built is a part of a solution that contains an ASP.NET MVC3 web UI, a class library business domain, and an installer for the windows service. Both the windows service and the MVC3 app reference the class library. I've marked only the Windows Service project as the "primary output" in the installer app.
Now, after a reboot, I can do build the installer and install the service and it runs great. However, after that first time, I have nothing but problems. In visual Studio, the uninstall option is grayed out, which is wrong, it should be active. I can uninstall in Windows but for some reason the process is still running. From there I cannot rebuild the installer project because the exe won't delete and is still running.
Where am I going wrong?

Categories

Resources