Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:01:51+00:00 2026-05-29T23:01:51+00:00

The REST project works fine, this can be accessed through this address: http://localhost:8525/Device/Login?deviceID=testid&password=a&serialNum=testserial I

  • 0

The REST project works fine, this can be accessed through this address:

http://localhost:8525/Device/Login?deviceID=testid&password=a&serialNum=testserial

I also have WCF SOAP project in my REST project, these two projects are separated in different folders, “SOAP” and “REST”.

My problem is that, after I put this code:

private void RegisterRoutes()
{
    RouteTable.Routes.Add(new ServiceRoute("Device", new WebServiceHostFactory(), typeof(Rest.DeviceComponent)));              
}  

I can’t access now the SOAP service which I was able to access before through this address:

http://localhost:8525/DeviceComponent.svc (using WCFTest Client)

Here is the WebConfig

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
    <handlers>
      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd"/>
    </handlers>
  </system.webServer>
</configuration>

And inside Global.asax.cs

private void RegisterRoutes()
{
    RouteTable.Routes.Add(new ServiceRoute("Device", new WebServiceHostFactory(), typeof(Rest.DeviceComponent)));
}    

SOAP sample contract

namespace TSDEVICE.SoapSVC.Interface
{
    [ServiceContract]
    public interface IDeviceComponent
    {
        [OperationContract]
        Session Login(string deviceID, string password, string serialNum, string ip);
        [OperationContract]
        bool Logout(DeviceSession session);
        [OperationContract]
        bool IsLatestVersion(DeviceSession session, int version);
        [OperationContract]
        byte[] DownloadLatest(DeviceSession details);
        [OperationContract]
        DateTime GetServerTime(DeviceSession session, long branchID);
        [OperationContract]
        bool AddDevice(UserSession session, Device deviceitem);
        [OperationContract]
        bool RemoveDevice(UserSession session, long deviceID);
    }
}  

And the REST part:

namespace TSDEVICE.Rest
{
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class DeviceComponent
    {
        [WebInvoke(UriTemplate = "Login?deviceID={deviceID}&password={password}&serialNum={serialNum}", Method = "POST")]
        [OperationContract]
        public TMODELDEVICE.Entities.Session Login(string deviceID, string password, string serialNum)
        {
            string ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            TMODELDEVICE.Logic.DeviceComponent restDC = new TMODELDEVICE.Logic.DeviceComponent();
            return restDC.Login(deviceID, password, serialNum, ip);
        }

        public string Sample()
        {
            return "Hello";
        }
    }
}  

I have to access SOAP and REST, how can I do that? Thanks a lot!

EDIT

When I try to “Set as Start page” the .svc file, I get this error:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.  

EDIT 2

Now I found out the real problem.

When ASP.NET compatibility mode in the web.config == true, SOAP fail to work, while REST requires it. What should I do with this? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:01:54+00:00Added an answer on May 29, 2026 at 11:01 pm

    I have a REST project that as both REST and SOAP service being exposed. Now I placed an .svc file for the SOAP service to be accessed by some clients.

    The below screenshot gives the folder structure of my project, the route configuration in global.asax, Output accessing the Rest Service and accessing the .svc file (SOAP service)

    sample screenshot

    UPDATE:
    Please find my web.Config (My application is hosted on IIS):

    web.config

    Please find my class that implements my interface ISampleService:

    class

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to share an eclipse project with the rest of my team through
I have an Add-in project for excel. It works fine on my computer. But
I just started to use WCF Rest project template to design a REST service,
I have a rest interface for my project. For one class i have a
I'm playing with the project ap pengine-rest-server to create the REST webservices for all
I'm getting started on building a REST API for a project I'm working on,
I am editing a open source project called Opencv for Delphi which compiles fine
I have created a WCF REST style service in my project. In development I
I am doing multiple HTTP POST to a REST web service that I created.
In .NET should you place unit test projects in with the rest of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.