I have a web api MVC5 REST service running in IIS Express under VS 2015.
I want to write unit tests to excercise the REST services.
I want to be testing the REST services syntax and output, not the controller.
My problem is gettin the IIS Express service to be started on a known port when the test starts. How can I configure/code this to make sure that IIS Express is started. (I also noticed a "web" profile in the Web API project's debug section. It seems to start the service as a console. But I can't figure out how to make use of that.)
Related
I am revising .NET and web services and attempting to test calling the web service I created with a WPF desktop application. The web service builds and runs fine and when I start without debugging in VS Community 2017 it works as expected and I can see the web service end points in the browser along with the WSDL. But when I attempt to add a WPF desktop application and start without debugging to the browser does NOT have the .asmx file in the URL anymore and states -
HTTP Error 403.14 Forbidden
the web server is configured to not list the contents of this directory
I have googled this error and tried several of the suggested fixes but none of them have resolved the issue. Can this be done at all or do I have to publish the web service to IIS Express on its own and have the WPF desktop application on its own? Its just that it would be very useful to have a desktop application within the same solution to code and test
I am trying to find out how to host an asp.net web API online and one option is to self-host using OWIN. This, however, means running the application from Microsoft Visual Studio. I was wondering if I can use this method of hosting on a web server such that my API is live on the web. The reason why I am asking is I don't know if I can install Visual Studio on a Windows server and run it. How would I run a visual studio application on a web server?
I am trying to run a custom site on IIS with ASP.NET whih connects to a site on the internet which is a coding community via HttpWebRequest.
If I use the Visual Studio built-in Development Server it successfully runs and shows the result of the Request.
But as soon as I use the local IIS for running the application I get an error saying that the site (which I am trying to connect to) is refusing the connection.
But there has nothing changed right? I have not changed my code at all!
EDIT: My understanding is that the IIS and VIsual Studio's "On-The-Run" IIS are in base the same. But why are they acting so different here?
Web applications in a production environment are hosted using Microsoft's IIS web server software. In the development environment, however, the application may be hosted using IIS or the ASP.NET Development Server. Ideally, the same web server software should be used in both environments because using different software adds another variable in the mix. However, the ease of use of the ASP.NET Development Server makes it an attractive choice in the development environment. The good news is that there are only a few fundamental differences between IIS and the ASP.NET Development Server, and if you are aware of these differences you can take steps to help ensure that the application works and functions the same way regardless of the environment.
Visual studio uses IIS Express to host your application, which is a lightweight, self-contained version of IIS. It is used by developers to develop and test websites inside the same machine(localhost). The major difference between IIS and IIS express is that IIS express doesn't accept request outside the localhost. while IIS accept the web request from any another machine inside the domain. SO in order to accept request from your application you have to deploy it to IIS not IIS express.
I built a Web API service that's hosted locally on my machine in IIS. I have an iOS app that I'm running via XCode that makes the call to the web service. The connectivity is there, and works. The iOS app successfully makes the connection to my published web service.
The problem is my web service is returning a non descriptive error to the client (iOS), so what I need to be able to do is step through the web service code while running my iOS app.
So, in summary:
I run an iOS app via my MacBook, and it connects to my .NET Web API service.
My Web API service is published to my local IIS, and is returning an error back to the client.
Breakpoints aren't being hit in Visual Studio - do I need to attach my Visual Studio debugger to a specific process? I've tried running my web service in debug mode while running my iOS app, to no avail.
How can I step through my web service code when running the client app (iOS) that accesses the web service?
Attach to process - http://msdn.microsoft.com/en-us/library/vstudio/3s68z0b3.aspx
Make sure "Show processes from all users" is checked, and pick w3wp.exe
You may need to hit the service once first to make sure its started.
To debug an app that's hosted by IIS, you want to attach to process (in Visual Studio it's Tools->Attach to Process or Ctrl+Alt+P) and pick w3wp.exe from the list (you might have to check a few boxes for the process to show up).
Another option is to use our free VS Extension called Conveyor
https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti
With it you open up IIS Express to remote connections on your network (or even the web through tunnelling).
Once you've done that you can debug the project directly from VS and connect to the Conveyor port number (or domain name via tunnelling) and debug as you would locally.
you can use Postman client.
First : run the API FROM visual studio
Second : go to postman put the url and add the parameter in body
More information : http://www.tutorialsteacher.com/webapi/test-web-api
this often works for me i generally list all of the processes in IIS with appcmd command
appcmd list wp
and pretty much you know which process to attach by seeing the names of the web services
if appcmd is not available please visit
Here for configuring this
My solution constists of -
WCF service hosted on Visual Studio Development server. (Port 8001)
Web Application consuming services. (Port 8002)
I use start multiple projects in debug mode in visual studio solution.
Starting with WebApp debugging, I set few break points in WCF service code.
Issue:
WCF services breakpoint is not being hit. Although the code executes fine & returns the response to UI (WebApp)
These work fine when starting WebApp & Wcf services using two different solution.
Any suggestions ?