none
Not able to browse WCF RRS feed

  • Question


  • <?xml version="1.0" encoding="utf-8"?> <!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.web> <compilation xdt:Transform="RemoveAttributes(debug)" debug="false" targetFramework="4.5.1" /> </system.web> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"> <serviceActivations> <add service="MyTest.Search" relativeAddress="~/Search.svc"/> </serviceActivations> </serviceHostingEnvironment> </system.serviceModel> </configuration>

    Above is web.config file.

    I am getting below error. I am new to WCF, Pls suggest what i am missing. Thanks!! 

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


    • Edited by Ankit G Wednesday, July 20, 2016 11:28 AM
    Wednesday, July 20, 2016 11:27 AM

Answers

  • Hi Ankit,

    >>Can you pls point me how to find correct value of Service attribute.

    How did you create your Service, WCF Service Application or WCF Service Library? Please check your ServiceContract. For below demo, the Service name is “WcfTimeout.Service1”.

    namespace WcfTimeout
    {
        // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
        [ServiceContract]
        public interface IService1
        {

    If you use WCF Service Library, please check whether you have added the Library reference, and check the ServiceContract in ServiceLibrary.

    In addition, I suggest you try Configuration Editor Tool to configure the config file in the WCF instead of writing it in app.config.

    If it did not work for you, it would be helpful if you could share us your detailed steps which we could try to reproduce your issue.
    Best Regards,
    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Thursday, July 21, 2016 1:32 PM

All replies

  • Hi,

    The "name" attribute of the element in the app.config is case sensitive.Can you please check the same and let me know?

    Wednesday, July 20, 2016 11:44 AM
  • Their is not app.config in the project. The service name is correct in web.config :)

    Any idea, Is there some configuration missing?

    Wednesday, July 20, 2016 12:25 PM
  • I guess i have figured out the issue but not the solution

    Service attribute of ServiceHost directive is not correct or formatted correctly.

    so far i have tried

    "MyTest.Search,My Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

    "MyTest.Search"

    but still getting the error. Can you pls point me how to find correct value of Service attribute.

    Thanks!!

    Wednesday, July 20, 2016 2:33 PM
  • Hi Ankit,

    >>Can you pls point me how to find correct value of Service attribute.

    How did you create your Service, WCF Service Application or WCF Service Library? Please check your ServiceContract. For below demo, the Service name is “WcfTimeout.Service1”.

    namespace WcfTimeout
    {
        // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
        [ServiceContract]
        public interface IService1
        {

    If you use WCF Service Library, please check whether you have added the Library reference, and check the ServiceContract in ServiceLibrary.

    In addition, I suggest you try Configuration Editor Tool to configure the config file in the WCF instead of writing it in app.config.

    If it did not work for you, it would be helpful if you could share us your detailed steps which we could try to reproduce your issue.
    Best Regards,
    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Thursday, July 21, 2016 1:32 PM