locked
Error:The type 'WebSyncContract.SqlWebSyncService', provided as the Service attribute value in the ServiceHost directive RRS feed

  • Question



    • Changed type JuneT Wednesday, June 30, 2010 9:48 AM
    • Edited by jerry7670 Wednesday, June 30, 2010 9:31 PM
    Wednesday, June 30, 2010 5:01 AM

Answers

  • Check the .svc file content, Then check the virtual directory whether all binaries are there under bin,  that contains type 'WebSyncContract.SqlWebSyncService', or if you use code behind file, check the .cs file is with .svc or right location.

     

    Wednesday, March 30, 2011 8:17 PM
    Answerer

All replies

  • Hi everyone, I am new to Sync Framework. I am trying the sample code for Sql to Sql express. But after I publish the WCF service into IIS and try to open the service at "http://localhost:8000/WebSyncContract.SqlWebSyncService.svc" I got this error:

    Server Error in '/' Application.

    The type 'WebSyncContract.SqlWebSyncService', 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 'WebSyncContract.SqlWebSyncService', 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 'WebSyncContract.SqlWebSyncService', 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) +51902
      System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1440
      System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
      System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +615
    
    [ServiceActivationException: The service '/WebSyncContract.SqlWebSyncService.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'WebSyncContract.SqlWebSyncService', 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) +679246
      System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
      System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
      System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +355
      System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
      System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    

     

     

    I have set the IIS with asp.net 4 and virtual directory, please help, thanks in advance

     

    • Merged by JuneT Wednesday, June 30, 2010 9:48 AM same question
    Wednesday, June 30, 2010 4:57 AM
  • have you checked your services section of the web.config file if the service is correctly entered?
    Wednesday, June 30, 2010 9:52 AM
  • <?xml version="1.0"?>
    <configuration>
    <system.web>
    <compilation defaultLanguage="c#" />
        <authentication mode="Windows" />
    </system.web>
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
    <system.serviceModel>
    <services>
          <service name="WebSyncContract.SqlWebSyncService" behaviorConfiguration="WebSyncContract.SyncServiceBehavior">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="largeMessageHttpBinding" contract="WebSyncContract.ISqlSyncContract">
    <identity>
    <dns value="localhost"/>
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <host>
    <baseAddresses>
                <add baseAddress="http://localhost:8000/RelationalSyncContract/SqlSyncService/"/>
    </baseAddresses>
    </host>
    </service>
    </services>
    <bindings>
    <wsHttpBinding>
    <!-- We are using Server cert only.-->
    <binding name="largeMessageHttpBinding" maxReceivedMessageSize="10485760">
    <readerQuotas maxArrayLength="100000"/>
    </binding>
    </wsHttpBinding>
    </bindings>
    <behaviors>
    <serviceBehaviors>
    <behavior name="WebSyncContract.SyncServiceBehavior">
    <!-- To avoid disclosing metadata information, 
              set the value below to false and remove the metadata endpoint above before deployment -->
    <serviceMetadata httpGetEnabled="true"/>
    <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
    <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
    <startup/></configuration>

    Here is the web.config setting, I haven't changed anything from the sample code
    Wednesday, June 30, 2010 9:30 PM
  • is your WCF IIS server deployment listening on port 8000?
    Thursday, July 1, 2010 3:50 AM
  • I think so, I already set TCP Port:800 in IIS->Default Web Site->Property
    Monday, July 5, 2010 1:20 AM
  • did you deploy it by simply right-clicking in Visual Studio and selecting Publish?
    Thursday, July 8, 2010 1:21 PM
  • I am getting this same error, and yes that is how I deployed my WCF service.
    Tuesday, November 23, 2010 5:29 PM
  • This is related to WCF setup issue. I would recommend you to post it on WCF forums

    http://social.msdn.microsoft.com/Forums/en-US/wcf/threads

    Thanks

    Jandeep


    jandeepc
    Thursday, December 2, 2010 6:08 PM
  • you have to make some changes to the service as it cannot be readily deployed to IIS by right clicking in VS and selecting Deploy. i believe someone has posted fixing this before.
    Friday, December 3, 2010 8:47 AM
  • Open Project settings->Application

    Check that you have choose "Output type" = "Class Library"

    Wednesday, March 30, 2011 4:13 PM
  • Check the .svc file content, Then check the virtual directory whether all binaries are there under bin,  that contains type 'WebSyncContract.SqlWebSyncService', or if you use code behind file, check the .cs file is with .svc or right location.

     

    Wednesday, March 30, 2011 8:17 PM
    Answerer
  • I have this exact same error ... I've gone thru all the suggestions but no solution yet.

    I also used the "Publish" to local directory and then I copy the directory over to my remote web server (IIS7).  My services directory does NOT have bin ... just my two services Client.SVC and User.SVC.  My web project has a bin and a ClientBin.  I keep my web services in a folder under the root of my web site called "Services".

    Code works fine under VS 2010 debug sessions, but when I publish and deploy I get the same error as OP.  If I bring up my Browser (IE) and navigate to the service via typing in an address i.e.   http://www.mywebsite.com/Services/Client.svc  on a remote computer I get the generic "Runtime Error" with no details.  If I IE from my web server and type in the same URL I get the exact same message as OP.

    My Solution is a template based on the Silverlight 4 + web application ... I've created two web services in my web project and reference those services via my SL4 code.  Deployment is done with right click on my web project and selecting "Publish" to a local directory, copy the files from my local directory to my remote web server.  SL 4 application code and the WCF web service use separate application pools.

    Not sure what I'm missing here??  Any help is welcome as I'm out of trial and error ideas.

    Thanks, Rob.

     

     


    "For me, it is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring." - Carl Sagan
    Monday, August 29, 2011 11:31 PM
  • if youre only publishing the svc files, how will it resolve the actual service implementation codes? if i recall the svc contains not much but directives.

    in your local debug session, do you have the web services running under the same web project? if yes, that explains why it runs because it can resolve the service dependencies in the web project's bin directory.

    Tuesday, August 30, 2011 2:40 AM
  • Well that's a good question, how will it resolve?  I guess I sorta expected that when I right click on the Web Project and select Publish that VS 2010 would INCLUDE all the files needed to move up the web site and the services in the web project -- is this a bug or by design?

    Yes, in my debug sessions the web services are running under the same web project.

    So what do I need to do to ensure that Publish will pick us the other files (implementation code)?

    Thanks, Rob.


    "For me, it is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring." - Carl Sagan
    Tuesday, August 30, 2011 5:20 AM
  • is your project a web site or a web application? when you do a publish, does it include a bin folder? if it does, copy that bin folder to where you deploy the svc files.
    Tuesday, August 30, 2011 5:32 AM
  • See my original post - "My services directory does NOT have bin ... just my two services Client.SVC and User.SVC. My web project has a bin and a ClientBin. I keep my web services in a folder under the root of my web site called "Services".

    My Solution is a template based on the Silverlight 4 application + web site (from the prompt that says do you want to add a web site to this solution).

    After some more research do I need to "Conver to Web Application" on my Services folder (that contains my .svc and svc.vb files) - this option is available when I right click on the Services folder in my solution (in my web site)?

    My web site Bin folder contains all the DLLs for my web site.  The ClientBin folder contains my .XAP.

    I think you are correct in that my "Publish" doesn't seem to understand my Services folder and .svc files are actually web services -- but how I go about getting my Publish to understand that, I don't know?


    "For me, it is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring." - Carl Sagan
    Tuesday, August 30, 2011 4:29 PM
  • Ok I've made some progress ... what appears to be happening in VS 2010 is that it's NOT building the BIN directory in the correction location ... it's making the BIN directory off the web site root directory and NOT in my "Services" directory.

    When I publish my SL Web Site (right click on the Web Project and select "Publish") and then select a Publish Method of "File System" and point to a local directory on my PC (i.e. C:\Publish) and select "Delete all existing files prior to the publish". VS 2010 creates the following in C:\Publish :

    bin - containing all the DLLs used by my web site and my web services that are part of the web site which includes MyApp.Web.dll.

    ClientBin - containing MyApp.XAP (SL assemblies)

    Services - contains my two files Client.svc and User.svc

    MyApp.aspx - stub to load my Silverlight application

    silverlight.js

    web.config

    So when I move these files to my test web server running IIS7 my SL parts work fine, but my two services don't work. So now if I move the "bin" directory under my "Services" directory and restart my web site under IIS7 my services now work!! Well work, meaning I can see them via IE and they will appear in VS 2010 when I (Add Services...) including the correct exposed methods.

    So is this just a bug in VS 2010 Publish feature?? Is there any work around other than manually moving the bin under my services directory every time I publish?

    Rob.


    "For me, it is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring." - Carl Sagan
    Tuesday, August 30, 2011 6:42 PM
  • let's backtrack a  bit. am a bit confused at the deployment on IIS 7.  You mentioned above the Services and the SL app are  on different application pools.

    so are you deploying them as separate apps in IIS?

    the Publish to local you specified above just seems right and VS 2010 is doing the right thing. Your project containing both your SL App, the web app hosting the SL app and the services is treated as a single application and as such deployed as one.

    Wednesday, August 31, 2011 1:22 AM
  • Yeah it is very confusing, probably because there are so many similar yet different flavors of web services under the Microsoft umbrella.

    I must have not communicated effectively. I do NOT have two web applications. I have a Silverlight application with a web application. I have added WCF-silverlight enabled web services to my web application. These web services are consumed by the Silverlight application (keep in mind these are all under the same solution) and apparently different from a standard WCF web service and/or a WCF RIA Web Service and a ASMX web service and ... ugh. There is one and only one web site and I'm now down to a single application pool.

    Apparently WCF-silverlight enabled web services MUST reside in the web site root directory, they can NOT be moved into their own Services directory (unless of course you do the Bin trick and copy the Bin to that Directory after you publish).

    Problems solved ... all good now. Deployment is simple and the services are working as expected ... FYI these service are based on WCF-silverlight enabled template in VS 2010. Which appears to be handled differently than regular WCF services and WCF RIA Services and the old school ASP Web Services (asmx). It sure can be confusing discussing web services as their are at least 4 (maybe more) flavors of them and each seems to have a unique method and/or restrictions when it comes to use and deployment ... what a mess. I guess this is what happens when you let the Microsoft Web Services team get a little "out of control" ;)

    Cheers, Rob.


    "For me, it is far better to grasp the Universe as it really is than to persist in delusion, however satisfying and reassuring." - Carl Sagan
    Wednesday, August 31, 2011 2:04 AM
  • on the contrary, it has nothing to do with the type of web service. the svc/asmx files themselves has no implementation. just like any other .net app, when you deploy something, it has to find and load the dependencies.

    in the project type your're using, the SL app, the hosting web app and the web services is one application and you cant break up the deployment without deploying the dependencies.

    Wednesday, August 31, 2011 2:15 AM