Andrew Cooper
Andrew Cooper

Reputation: 747

Access one project from another on localhost in ASP .NET

I have inherited an ASP .NET solution with two projects; the website and a service. The code in the website uses the service for a variety of queries. I've needed to make some changes to the code in the service and have done so. However, when I run the code on my localhost in Visual Studio, the changes aren't showing up. I think I found out why. In the website's webconfig file I have this...

<endpoint address="http://some.really.cool.site.com/OnBoardingWCFService/Service1.svc" 
                behaviorConfiguration="SerializerObjectsGraph" 
                binding="basicHttpBinding" 
                bindingConfiguration="BasicHttpBinding_IService1" 
                contract="OnBoardingWCF.IService1" 
                name="BasicHttpBinding_IService1"/>
<endpoint address="http://some.really.cool.site.com/OnBoardingWCFService/Service2.svc" 
                binding="basicHttpBinding" 
                bindingConfiguration="BasicHttpBinding_IService2" 
                contract="OffBoardingWCF.IService2" 
                name="BasicHttpBinding_IService2"/>

It looks to me like the website is using the service that has already been published. This obviously wouldn't have my new code in it. I have two questions.

First, when running the solution in Visual Studio, does it run both projects on localhost or just the startup project.

Second, how do I have the website actually point to the localhost version and not the published version? I've changed the address in the webconfig to be http://localhost:3333 but that doesn't seem to work.

Upvotes: 1

Views: 858

Answers (1)

Cam Bruce
Cam Bruce

Reputation: 5689

Visual Studio will only run the startup project by default. You'll have to start each app independently.

For your first question you have a couple options.

  1. It looks like your apps are configured to run on IIS Express. You'll need to have both applications running. The easiest way to do this is by running two instances of Visual Studio and starting each project independently of each other.

  2. Setup your apps so they are deployed on full blown IIS so your apps will always be available regardless of running Visual Studio or not.

For your second question, look in your web.config to see if there are endpoints pointing to the specific service.

Upvotes: 1

Related Questions