Jim Platts
Jim Platts

Reputation: 25

unable to run wcf service app with a renamed service?

I have a basic solution and I've added a WCF service lib. I can view the default service created in the browser after the initial wcf service app has been added to the solution. However, after I rename the default wcf service and its interface class and then view the service in the browser, the web page displays the following runtime error:

The type 'MyNewService.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

However, if I search the project structure for 'Service1' then no references to 'Service1' are returned. Any idea what the root cause of this error might be? It seems like I've been able to do this successfully several times in the past and I don't think that I've ever encountered this roadblock before.

Upvotes: 0

Views: 139

Answers (2)

Michael Brown
Michael Brown

Reputation: 9153

By default, WCF is configured and exposed via the App.config file of your library. Do a search within your App.config to find the old name and change it to the new.

When you want to change the name of your service in the future, use the refactor name (default ctrl+r, r) operation and it will find the name in the config file for you as well.

Upvotes: 0

Trent Rudisill
Trent Rudisill

Reputation: 11

Look in the app.config, look at endpoint->contract, im guessing thats where need to update it.

<system.serviceModel>
    <services>
        <service name="WcfServiceLibrary1.MyService1">
            <endpoint address="" binding="basicHttpBinding"                 
                contract="WcfServiceLibrary1.**IMyService1**">

Upvotes: 1

Related Questions