none
Visual Studio 2013 WCF Web Service error while running in debug using IIS Express RRS feed

  • Question

  • Hi, I think I might have a problem with my local environment that I cannot figure out how to fix. Some background... I created a WCF web service and was able to step into the web service when the WCF Test Client loaded in either IIS Local or IIS Express.  In order to check the solution into Visual Source Safe I had to move the solution folders. After moving the solution I could no longer debug the web service and started getting Metadata errors.  I have researched for days trying many different web.config binding and other attempts to get this resolved.  So, I decided to create a simple Hello World web service in a different solution and getting the same error message "Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata". Since I now have two different web services displaying this error then I think something may be corrupted on my local machine.

    Some items I tried...  deleted the 'applicationhost.config' in my users folder and restarted Visual Studio... no help.

    Uninstalled IIS 7 from my machine and rebooted hoping that IIS Express might somehow work afterwards... no help.

    Added various service behaviors to web.config, etc... No Help.

    I would GREATLY appreciate any help and below is the full stack trace.  THANK YOU in advance!  

    Error: Cannot obtain Metadata from http://localhost:65111/SemsService2.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:65111/SemsService2.svc Metadata contains a reference that cannot be resolved: 'http://localhost:65111/SemsService2.svc'. The requested service, 'http://localhost:65111/SemsService2.svc' could not be activated. See the server's diagnostic trace logs for more information.HTTP GET Error URI: http://localhost:65111/SemsService2.svc There was an error downloading 'http://localhost:65111/SemsService2.svc'. The request failed with the error message:--
    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    The type 'CvrOLVR.Service2', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The type 'CvrOLVR.Service2', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:

    [InvalidOperationException: The type 'CvrOLVR.Service2', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +764   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1849   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +66   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +738[ServiceActivationException: The service '/SemsService2.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'CvrOLVR.Service2', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..]   System.Runtime.AsyncResult.End(IAsyncResult result) +604035   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +238   System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +436100   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +116


    --------------------------------------------------------------------------------
    Version Information:ÿMicrosoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0 --.

    Wednesday, July 27, 2016 10:28 PM

Answers

  • A couple of things to try:

    • Host in IIS - 
    • Verify the project builds without any errors
    • Verify the .svc file has a service reference that matches your classname including namespace (did you change the namespace ever?)
    • can you post your serviceModel configuration from web.config - I want to see the enpoint address contract

    Similarly reported issues (in case you have not looked at these)

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/4aab8a20-f39f-4c8d-aad2-8762ef87a66c/systemservicemodelservicehostingenvironmentserviceactivations-could-not-be-found?forum=wcf

    http://www.ienablemuch.com/2011/05/wcf-serviceactivations-could-not-be.html

    http://stackoverflow.com/questions/17591972/wcf-service-the-type-provided-as-the-service-attribute-values-could-not-be-foun

    http://stackoverflow.com/questions/2739465/deploying-wcf-tutorial-app-on-iis7-the-type-could-not-be-found/2741956#2741956


    Jeff

    • Marked as answer by brcbrc Thursday, July 28, 2016 6:00 PM
    Thursday, July 28, 2016 12:35 AM

All replies

  • Sorry brcbrc, no idea really but did you change anything outside of your project folders like machine.config?

    Are you saying that if you try to hit the IIS hosted service you get  http://localhost:65111/SemsService2.svc returned in the error message even when you start with a new project?  Or is the url different but the error message both say the type could not be found?


    Jeff

    Thursday, July 28, 2016 12:09 AM
  • Hi Jeff,  I didn't change anything (that I know of :) ) other than uninstalling IIS 7 when I could not figure this problem out. This is occurring when I am in VS 2013 IDE and hit the run button ("Internet Explorer"). The WCF Test Client window opens and the error is displayed (please see attached images).  Thanks

    Thursday, July 28, 2016 12:26 AM
  • A couple of things to try:

    • Host in IIS - 
    • Verify the project builds without any errors
    • Verify the .svc file has a service reference that matches your classname including namespace (did you change the namespace ever?)
    • can you post your serviceModel configuration from web.config - I want to see the enpoint address contract

    Similarly reported issues (in case you have not looked at these)

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/4aab8a20-f39f-4c8d-aad2-8762ef87a66c/systemservicemodelservicehostingenvironmentserviceactivations-could-not-be-found?forum=wcf

    http://www.ienablemuch.com/2011/05/wcf-serviceactivations-could-not-be.html

    http://stackoverflow.com/questions/17591972/wcf-service-the-type-provided-as-the-service-attribute-values-could-not-be-foun

    http://stackoverflow.com/questions/2739465/deploying-wcf-tutorial-app-on-iis7-the-type-could-not-be-found/2741956#2741956


    Jeff

    • Marked as answer by brcbrc Thursday, July 28, 2016 6:00 PM
    Thursday, July 28, 2016 12:35 AM
  • Thank you Jeff... people like you make the world a better place.
    Thursday, July 28, 2016 6:00 PM