Not able to debug an asmx service - c#

I have 2 solutions both running in VS2013 on Windows 10.
One solution is the client which calls the asmx service located on the same host.
Another solutions is the service it self which I launch in debug mode with debug configured in the web.config.
When I want to step into the call I get the message
Unable to automatically step into the server. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server
I run the web service on "Local IIS" in debug mode. In the client I tried attaching the process where the web service is running but also no success.
I added the users "IUSR" and "IIS_IUSRS" to the folders of the web service with full permissions.
Any idea what else I can do to make this work ?

Related

windows service hitting different link than what specified in service address

I have installed a application on my machine which eventually installed some windows services which will be used by that application, there is UI screen in that application which enables to start the windows service and we can see the service address in the screen, but every time I start the service it is hitting a different link. I have debugged the code and there is no mention of that link which the service address is referring, is that a possibility that my application is importing some internet explorer or network settings? I am working on .Net 4.6.1 and my application is also build in 4.6.1

Web Deployment Agent Service returns a 500 Internal Server Error

I am attempting to deploy a web site remotely using the Web Deployment Agent Service. When running the cmd file generated by Visual Studio using /m command switch, I get the following error:
Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
More Information: Could not connect to the remote computer ("x.x.x.x") using the specified process ("Web Deployment Agent Service") because the server did not respond. Make sure that the process ("Web Deployment Agent Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
Error: The remote server returned an error: (500) Internal Server Error.
I checked the link and it has 3 suggestions. Make sure the service is running which it is. Make sure that the user is an administrator which it is and make sure the firewall isn't blocking the traffic which it isn't.
I turned on wireshark to see if that would get any clues and I get the initial 401 Unauthorized from the deployment service and then the client makes the request again using NTLMSSP_NEGOTIATE. That is when the deployment service returns the 500.
I am guessing it is some sort of permissions thing on my deployment server, but I can't narrow it down. Does anyone know where the Web Deployment Agent Service logs or how to turn on logging for that service?
If you look at this article about setting up Web Deployment server
https://technet.microsoft.com/en-us/library/dd722796(v=ws.10).aspx
in step 6 it points to this artical about setting up logging adn tracing
https://technet.microsoft.com/en-us/library/ee461173(v=ws.10).aspx
Did it work previously? I've had the same issue, WebDeploy suddenly broke down after a reboot on 19th december, some windows update. I've had to remove WebDeploy 3.6 from program and Features and then to uninstall the IIS Webmanagement Role through the server manager.
After rebooting i've installed Web Deploy 3.6 for Hosting Servers through Web Platform installer again and it worked again.

Unable to consume web service

I published a simple Hello World web service in an ASP.Net web service project.I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.When I paste the url, I get the following error
There was an error downloading 'http://localhost:65436/Service1.asmx/_vti_bin/ListData.svc/$metadata'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:65436
I am using Visual Studio Ultimate 2013, I don't have IIS server installed.
UPDATE- : I created a new Console based project in the existing solution and it works fine.But the problem is how do I run this console project,when I click the debug button, it deploys it on browser.I simply printed the string output returned by web method,I need to see this output on console.
I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.
Because the web service is not running. Web service references can only be generated when the metadata is available.
You can either:
Run two instances of Visual Studio, one for the web service and one for the client
Put a service and client project in one solution.
Also, you shouldn't use ASMX for new development. Take a look at WCF and WebAPI.
Sometimes it happens to me too. I press F5 to start debugging the web service, immediately stop debugging, and then try to update the web reference again. Usually it helps.
you can deploy the web service on IIS then consume it in console application.

How To Deploy WCF To IIS And Have It Stay Alive

I've created a basic WCF service library project and deployed it to my local IIS installation (7.5).
Whenever I try to navigate to it via localhost/TestWcfServiceLibrary/ I just get a directory view.
However, if I start the service in debug mode from visual studio, I get the system tray popup telling me that it's been hosted, and then when I go back to localhost/TestWcfServiceLibrary/, I'm able to see the wsdl.
As soon as I stop debug mode and refresh the browser, I'm back to the directory view.
The base address in the config file is localhost/TestWcfServiceLibrary/ so I don't understand why I'm seeing this behavior.
Interestingly, if I navigate to localhost/TestWcfServiceLibrary/service.service1.svc (A file that doesn't exist) I get the wsdl even when debug mode is off.
So I have 2 questions.
1) Why does debug mode in visual studio have any affect at all on whether or not I can access the wsdl from the path localhost/TestWcfServiceLibrary ? (I suspect it's because the wcf service is not technically hosted at "localhost", it's hosted at , so the address doesn't really exist until debug mode is turned on, so I'm actually connected to the temporarily hosted version that visual studio provides and NOT the real IIS hosted webservice?)
2) When deploying a WCF service library directly to IIS, is it always correct to point to the .svc file with a the namespace and class name of your service contract, even though that file doesn't really exist (I'm guessing that's the magic that IIS performs for you)?
1) You can see where your webservice is hosted in the Web tab of the properties of your WCF project. Default behavior in VS.NET is to host your project in IISExpress, a mini IIS that comes with Visual Studio.NET and that is automatically started when you run a service. So, if you haven't changed the default then yes, your service is technically hosted at "localhost", but not on port 80 in IIS but on another port in IISExpress (The exact port varies)... I guess it's IISExpress that decides to give you the wsdl when you browse to the service address. That is not default behaviour of IIS. That will show the folder contents if directory browsing is enabled in the web.config, and otherwise gives you a 404 (not found) error.
2) There are 2 ways to activate a WCF service in IIS. Either you provide a real .svc file that lists what service implementation IIS should start. Either you indicate that in the node in your web.config file. It is the .svc part of the URL that triggers IIS to start the service.

Debug C# web service

I have a web service project and simple test application. I can debug the web service from Visual Studio 2008. However, there exist a real client application, but it is on another machine. ASP.NET Development Server does not allow connections if they are not from localhost, or so it seems. Is there a way to debug a web service, if client application is on another machine?
Edit
The tool that I used is Trace Utility from Microsoft SOAP Toolkit. Further explanation can be found here (works on XP; see continuation story for Windows 7 solution). There was problem with it though. My remote client fetches the WSDL first, and then creates URL based on values in soap tags found at the end of WSDL. So client gets redirected to localhost, which is not good.
I found my problem though, but I'll leave the question open until I find the time to try debugging via IIS.
Install a virtual directory into the IIS on your local machine. If you don't have IIS, install it. Once IIS is installed and configured on your local machine, you should be able to use either the IP or create a dns alias for that IP to access the web service that way.
I'm using SoapUI basic version to fake the SOAP requests to the web service, which is running in debug mode in Visual Studio, from the local computer.
You can use IIS (or Cassini Web server) - for debugging, attach VS 2008 to correct process (for example w3p.exe(IIS6 or greater) or aspnet_wp.exe(IIS 5)).

Categories