none
about WCF Service in SharePoint RRS feed

  • Question

  • Hi there,

     

    I created a WCF Service in the SharePoint. And I have a Class Library will involve the WCF service from my client's machine.

     

    I added Service Reference of the service http://win-6clkd4aeaol:8096/_layouts/15/SPWCFService/SPService.svc and login. I got the error message "An error occurred while attempting to find services at 'http://win-6clkd4aeaol:8096/_layouts/15/SPWCFService/SPService.svc'. The remote server returned an error: (404) Not Found. ". I have a try to test my WCF Service on my SharePoint Lab and connect to http://win-6clkd4aeaol:8096/_layouts/15/SPWCFService/SPService.svc/GetData?F=5. it works properly.

     

    I have no idea on it. why I cannot add WCF Service from my SharePoint Server.??

    Thanks for ur help.


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Sunday, October 20, 2019 2:10 PM

Answers

All replies

  • Hi,

    Could you access the WCF hosted server?

    You should be able to access the wcf from browser /_layouts/15/SPWCFService/SPService.svc

    Attach two threads for your reference.

    http://dvsivakrishna.blogspot.com/2014/05/creating-custom-wcf-rest-service-for.html

    https://www.sharepointpals.com/post/step-by-step-procedures-to-create-a-wcf-service-application-for-sharepoint-2013/

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by Will .H Monday, October 21, 2019 1:31 PM
    Monday, October 21, 2019 1:52 AM
  • Hi

    Where do you add the service reference? Make sure the service can be called there.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Learn Microsoft 365 from Microsoft DOCs now!
    Please Vote and Mark as Answer if it helps you.

    Monday, October 21, 2019 2:41 AM
  • Hi Lee,

    You should be able to access the wcf from browser /_layouts/15/SPWCFService/SPService.svc -> I can access this from local or remote by Explorer and  get the correct value.

    I will have a look the above article you gave me. Thanks

    WILL


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Monday, October 21, 2019 2:43 AM
  • Hi Justin,

    Call it from C# Class Library from my client's lab machine - windows 10. Sure, from here we could call it by Explorer.


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Monday, October 21, 2019 2:44 AM
  • Hi Lee,

    I followed the above article and got the error message as the following:

    Sorry, something went wrong

    The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.

    Correlation ID: 6aff0f9f-c4a8-404b-d55a-cae46a21da64

    Date and Time: 10/21/2019 3:08:10 AM


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    Monday, October 21, 2019 10:10 AM
  • Hi Lee,

     I add a line configuration like the following: and it works fine.

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Service : IService
    {
    }

    Thanks


    Hi there, if you found my comment very helpful then please | Propose as answer | . Thanks and Regards.

    • Marked as answer by Will .H Monday, October 21, 2019 1:31 PM
    Monday, October 21, 2019 1:29 PM