WinCe cannot connect and consume WCF service - wcf

I created a test WCFServiceLibrary project leaving the example code created by VS20212, then i created a ConsoleApplication in the same solution and added a web reference to the service.
In my ConsoleApplication i write this:
var ns = new ServiceReference1.Service1();
Console.WriteLine( ns.GetData( 100 ) );
I press F5 and everything seems fine.
Now i keep my WcfTestClient (the server hosting my service when launching from visual studio) running and create a new CompactFramework 2.0 ConsoleApplication project from VS2008.
I add a web reference as before, i compile and distribute my app on my test device I try to execute the same code you see above but i get this error:
"Unable to connect to the remote server" inner exception {"No connection could be made because the target machine actively refused it"}
Dows WcfTestClient have some limitation that do not allow me to connect from outside localhost? How can i solve this problem?

I had to change 'localhost' to my actual server ip in my CompactFramework project's app.config since i was remotely debugging an application deployed on a real device :)

Related

Connect VS2022 debugger to ASP.NET Core application hosted on windows server IIS (2019)

I'm having issues with ASP.NET Core 6 app on my VPN Windows server 2019. Basically, I have Syncfusion OCRProcessor with tesseract files, but my application can't find part of the path for tesseract binaries on server when locally is working fine (on server error message is "cannot find part of the path C:\inetpub\wwwroot\myapp\x64").
After contacting Syncfusion support didn't solve the issue, I have checked for permissions in file system, double checked the locations of the binaries on IIS, checked if dll's are blocked in from Windows in file system. I have tried to connect from my machine with VS 2022 Community to my VPN server (public IP address) to try to debug the application, but going trough all the documents about remote debugging, still I can't connect to my app and hit the breakpoint in code to determine what is happening..
I have installed remote debugger for VS 2022 onto server, configure it and started, I have published application again over web deploy with debug config to IIS, but I just don't understand next step - how to attach to the process on external server..
Most of the videos and documentation suggests that IIS is installed locally on development machine, or IIS is on some PC in local network, but I have public server.. Can anyone help with the advice how to proceed further?
Thanks!
Ok, I have managed to connect debugger from VS 2022 to IIS.
The issue was in port, firewall and also in description on Microsoft help site https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer?view=vs-2022 where in step 3 is written "Set the Qualifier field to and press Enter." - you need to enter ip address and port into connection target textbox.
After succesfull logging in onto server, I needed to select w3wp.exe process with title "CoreApp: https://.. ", set breakpoint in VS 2022 and open ASP.NET Core app in browser. After that I managed to debug application on IIS.
Hope this would be helpful to someone!

Web Deploy results in ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

We are trying to configure continuous integration with TFS 2012. While queuing a new build, the publish fails with the error:
Build FAILED.
"C:\src\ProjectName.sln" (default target) (1) ->
"C:\src\Website\ProjectName.csproj" (default target) (2) ->
(MSDeployPublish target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4377,5): msdeploy error ERROR_COULD_NOT_CONNECT_TO_REMOTESVC: Web deployment task failed. (Could not connect to the remote computer ("ServerName") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC)**
I checked all the points mentioned in the IIS.NET documentation for this error. Both services mentioned, Web Management Service and Web Deployment Agent Service, are running fine. A restart of those services has no change in behavior.
Windows Server 2008 R2 with IIS 7.
Web Deployment Agent Service is running on port 8172.
Web Deploy 3.0
Windows Firewall is not blocking any port on the server.
How can this be fixed?
If you install Web Deploy 3.x BEFORE Web Management Tools are installed, you'll have to re-install Web Deploy. I beat my head against the wall for hours on this.
Install the Web Management Services ("Turn Windows Features On/Off"/Roles -> Web Server -> Management Tools -> Management Service)
Then uninstall Web Deploy (repair didn't work) via the usual Add/Remove Programs control panel
Install Web Deploy 3.x again using Web Platform Installer.
Fixed. /Sigh
Double check in your Web Deploy settings that the name of the website is exactly that of what's in IIS.
Ben Day blogged more about it.
Fix that i saw on another website:
Fix it by adding “http://” to server.
In other words, when server is www.xxxx.com would get the 403 error, but when server is http://www.xxxx.com, then it works.
You need also to indicate the app name e.g 'Default Web Site/MyApp'
That was my error. Once I added /MyApp, it worked.
I got this error when using msdeploy, not TFS. In my case I needed to make sure the user msdeploy is using had permission to deploy to the website.
Find the website in IIS manager, right click and go to Deploy, then Configure Web Deploy Publishing. Find the user used by Web Deploy and setup for this website.
In my case the Internet proxy was enabled on source - which made msdeploy to reach out to internet instead of local ICN.
You should check the logs on your IIS first - see that you actually get to the server, and then you can locate the exact error here - https://support.microsoft.com/en-us/help/943891/the-http-status-code-in-iis-7-0-iis-7-5-and-iis-8-0
Uninstalling and re-installing (not repairing!) after setting up IIS did most of the magic for me.
There is another possible cause of the error. IIS Managemente Service have its own configuration for IP Address Restrictions, which default value is Deny Access for unspecified clients (Windows Server 2012 R2 with IIS 8.5).
You must set this value to Allow or add access to your specific IP address/IP address range using the Allow... button.
Remember, you must Stop the Management Service previously to change this configuration.

Unable to launch solution: MyApp is configured to use IIS. The Web server 'http://localhost:64646/' could not be found

When trying to launch solution, I receive the following error:
error : The Web Application Project MyApp is configured to use IIS. The Web server 'http://localhost:64646/' could not be found.
How do I resolve this issue?
I opened IIS and set the TCP port on the Default Web Site to 64646 and the project loaded without error.
You need to install IIS on your development machine.
Using IIS you'll also need to run Visual Studio in Admin Mode as well.
It is recommended that you use IIS Express since it will allow you to run VS without Admin privileges.
You have to install IIS and create the web site in IIS with the matching port number. Someone else created the visual studio web project to use IIS and configured it on their computer. Each person who opens the solution has to have all the websites configured in IIS manually.
You might consider creating a script that auto-creates them in the source repository. You can do it using AppCmd.exe (ADD SITE, ADD APPPOOL, LIST APPPOOL, LIST SITE) (%windir%\system32\inetsrv\AppCmd.exe).

visual studio 2010 wcf debug

I have 2 virtual directory on my IIS (first for server developing and second for client devloping).
Each directory point to different folders:
c:\Server\ -> localhost/Server/service.svc
c:\Client\ -> localhost/Client/service.svc
(Whenever server "binaries" are stable I copy them to Client path)
My problem is that whenever I start debugger for server (where in VS I set "Use local IIS web server" to "localhost/Server/service.svc" ) the breakpoints are also hit form localhost/Client/service.svc (also when "binaries" are different).
I thing it is because debugger connect to w3wp.exe .
I tried to change AssemblyInfo.cs but that didn't help.
Thanks.
I assume that run both websites under the same IIS AppPool. This means that both websites run in the same process. You need to use different IIS AppPools if you want Visual Studio to debug only Server.
Also you probably have architectural issue. Usually there is no need to have the same service.svc in client and server.
Normaly you should have one Visual Studio solution with 3 projects configured as follows:
Project with Contracts (contains data and service contracts)
Server project with *.svc files
Client project that contains Server references generated for Server endpoint.
Both Client and Server reference Contracts.

How to debug a remotely hosted WCF web service

I am new to WCF web service development and I can use some help.
I have a simple web service written in C# that I'm hosting on a remote server (it's hosted on IIS 5.1).
I've written a client application for that web service that I'm running on my workstation.I am able to connect to the service without any problems.
However, I would like to be able to debug the web service.I need to be able to step through the code, set breakpoints, etc.How do I achieve that from my local machine? I'm using Visual Studio 2010.
Thank you in advance.
I see two possibilities:
Local debugging: For debugging, run your service on your local machine. If you want to run it on the local IIS, simply start a second instance if VS2010 and attach to the w3wp.exe process (menu Tools -> Attach to process)
Remote Debugging: You have to install and start the VS2010 remote debugger on the server. Start a second instance of VS2010 on your development box and connect to the remote debugger with menu Tools -> Attach to process.
See msdn for more information about remote debugging with VS2010.