-
Issue 1 - Error message: "No connection could be made because the target machine actively refused it."
-
Issue 2 - When adding a type from another assembly (such as adding "IPersonReader" to the "ServiceReader" class), it has red squigglies and will not build.
-
Issue 3 - Error message in Visual Studio: "Process with an Id of XXXX is not running".
Error message when running the sample application.
'No connection could be made because the target machine actively refused it. [::ffff:127.0.0.1]:9874 (localhost:9874)'
The web service is not running.
In Visual Studio, set the solution to have multiple startup projects.
- Right-click on the solution in Solution Explorer.
- Choose "Set Startup Project" ("Properties" will also get you there, but you may need to navigate once the popup has opened).
- In the dialog, select "Startup Project" (under "Common Properties").
- Select "Multiple startup projects".
- Set "People.Service" to "Start without debugging".
- Set "PeopleViewer" to "Start".
- Click "OK".
Now when you run the application (using "F5" or the "Start" button on the toolbar), both the service and the web application will start.
If you are using Visual Studio Code and/or command line tools, then please follow the instructions under "Running the Application" in the main README.md file.
When adding a type from another assembly (such as adding "IPersonReader" to the "ServiceReader" class), it has red squigglies and will not build.
There is a missing assembly/project reference or "using" statement for the "PersonReader.Interface" project.
Sometimes "Ctrl+." does not work to add the project reference or "using" statement. I have found that if I mis-spell a reference (or get the capitalization wrong) sometimes Visual Studio can find it, but sometimes it cannot.
Manually add the assembly/project reference and "using" statement.
To add a project reference in Visual Studio:
- In Solution Explorer, expand the project (I'll use "PersonReader.Service" here).
- Right-click on "Dependencies" and choose "Add Project Reference..."
- Check the appropriate project name ("PersonReader.Interface" here).
- Click "OK".
To add a project reference in Visual Studio Code:
- On the command line, navigate to the project folder ("PersonReader.Service").
PS C:\source\Interfaces\Module3\Extensibility\PersonReader.Service>
- Type "dotnet add reference" and then the project name
PS C:[path]>dotnet add reference ..\PersonReader.Interface\PersonReader.Interface.csproj
Note: Command-line completion helps here.
To add a "using" statement, add the following to the top of the file:
using PersonReader.Interface;
Error message when running the sample application in Visual Studio.
'Process with an Id of XXXX is not running'
Visual Studio is trying to use IISExpress host the web application.
Visual Studio: Get the latest version of the sample code from this repository. Both the .NET 5.0 and .NET 6.0 versions have been updated so that this issue should not occur.
Manual Fix: If you would like to fix the existing code on your machine, switch the People.Service and PeopleViewer projects to run directly instead of using IISExpress. This is only if you want to fix your existing code. The easier option is to get the latest version of the code samples from this repository.
-
In the Solution Explorer, right-click on the People.Service project and select "Set as Startup Project".
-
On the toolbar, use the down arrow next to "IIS Express", and change the option to "People.Service".
-
This should now show the name of the project ("People.Service") on the "Start Debugging" button.
-
Repeat the above instructions for the "PeopleViewer" project.
-
Set the Solution back to using multiple startup projects by following the steps in Issue 1.
There are quite a few steps here, so I would recommend getting the latest version of the code.