Suppress Asp.net MVC 4 to run the browser - visual-studio

I have an asp.net MVC4 WEB API project as a service for a WPFclient , both projects run when I press F5 so the browser opens , and I can not avoid this behavior.
Any suggestions?
Thanks.

Check the startup project's configurations, or solution configuration, to ensure you don't have more than one application or project starting simultaneously in development.
This is similar to setting to Azure Web Roles where you can set your web role to startup both the HTTP and HTTPS endpoints so you can end up with two browsers starting up in debug (F5) mode. Easily fixed by accessing the project's properties where it's configured.

Related

IIS Express Web API and multiple projects

-My Web API project running in its own project is fine.
-Trying to run my Web API project from within a solution which contains another web project I get the following suggestion given its 'forbidden'
1. Go to the IIS Express install directory.
2. Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
3. Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
The first appcmd suggestion works fine, the second does not. I believe the reason is because my site name does not exist in iis Express until it runs or I am doing something else wrong.
This leads to the last question.
-Can I even have a Web API project running while another web project in the same solution consumes its methods. I assume the answer is no.
In fact I assume that if I want to have a web application consume the methods of this Web API application I am going to have to install a proper IIS stand alone.

Visual Studio Web Package - doesn't appear to create full Application

I've got a .Net 4 ASP.Net application developed with VS 2012. I'm publishing the app with a publish profile set to create a Web Deploy Package, which I'll be copying over and creating on a Win2008 IIS7.3 server.
When I run the deployment script, server-side, with a "/Y" parameter, it appears to work correctly.
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:package='C:\ReconTool\test\deploy\ReconTool.Presentation.Web.zip"
-dest:auto,includeAcls="False" -verb:sync -disableLink:AppPoolExtension
-disableLink:ContentExtension -disableLink:CertificateExtension
-setParamFile:"C:\ReconTool\test\deploy\ReconTool.Presentation.Web.SetParameters.xml"
Info: Adding sitemanifest (sitemanifest).
Info: Creating application (Default Web Site/ReconToolTest)
Info: Adding virtual path (Default Web Site/ReconToolTest)
...
But the new web site doesn't run for me - I get an 403.18 - forbidden error. When I look in inetmgr on the server for the new app, I only see the 'IIS' config section, where applications I've created manually have an 'ASP.Net' and the 'IIS' config sections.
It appears like it's not creating a full application, there are no error pages, etc, that are configured in the ASP.Net section. Wierd thing is I see the new app via appcmd as an application:
APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/ReconToolDev" (applicationPool:ReconToolDevPool)
APP "Default Web Site/ReconToolTest" (applicationPool:ReconToolTestPool )
Both the Dev and Test application pools appear to be exactly the same, from what I can tell. The web.config in my Dev and Test applications are identical.
I'd appreciate any advice on additional steps I need to deploy an Visual Studio project and get it to config as an application in IIS.
Corey.

Service in Silverlight application does not work when deployed

I've created a Silverlight application that uses a service. The service is defined in the web project in that solution. The silverlight application references it and uses it.
Everything works locally on my dev machine when I run the application in Visual Studio.
I note that the url im given from VS is: http://localhost:50453/Default.htm
But when I deploy this (by filesystem copy deploy option) the web page starts and it looks okey except that it seems to have a problem using the service.
In the Silverlight application, if I look at the reference settings the url to the service is: http://localhost:50453/SilverlightService.svc and thats probably whats wrong, as the server that Im deploying to does not have a clue whats on port 50453.
So Im trying to change this port to 80 on my dev machine but Im out of luck. My web project does not have any property where I can change the port. Opened URL and URL is locked at http://localhost:50453 :-/
How can I change the my dev environment to match the production environment with port 80?
For sure you can change the web project's URL in project properties, but this is not a good solution because you'll get the same problems when accessing the SL application from a remote computer.
You need to set the service URL programmatically, like above:
ServiceReference1.Service1Client svc = new ServiceReference1.Service1Client();
Uri serviceUri = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, "Service1.svc");
svc.Endpoint.Address = new System.ServiceModel.EndpointAddress(serviceUri);
This solution uses the same URL that you are using to access the Silverlight Application.

Web service in an ASP.NET MVC application

I have an ASP.NET MVC application in a solution, and inside the same solution there is another webservice project. I need to debug a particular WebGet method inside that service using a url in my localhost. Am able to reach the web service where it is hosted using the actual url to that service. But if I have to debug it, how can I reach that method when running in localhost?
You need to use IIS Express How to: Specify the Web Server for Web Projects in Visual Studio. Using IIS express you can debug and run both projects in your solution at the same time.
IIS Express for Developers

how do I add a test web service to my project in Visual Studio?

I have a test web service replicating a live web service that hasn't been made public yet (It will be public when the app is released).
I added a new ASP.NET Web Service Application to my solution. Now when I try and add a web reference from the main project and choose "Browse To Web services in this solution" it doesn't find the test web service.
Am I missing an important step here?
Maybe the webservice you're trying to connect to isn't running . Do an F5, verify that the service has started by checking the address in the browser then try to add the refference again.
If it doesn't work, just specify the address by hand.

Resources