2014-10-08 5 views
0

저는 WCF 서비스에서 완전히 새로운 것입니다. 이 REST WCF 서비스 (라우팅 서비스)를 개발했습니다.WCF 서비스 URL의 일부가 매번 동적으로 생성됩니다.

내 Web.config의

<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
</system.web> 

<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> 
</system.webServer> 

<system.serviceModel> 
    <serviceHostingEnvironment 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> 

    <behaviors> 
     <serviceBehaviors> 
      <behavior name=""> 
       <serviceMetadata httpGetEnabled="true" policyVersion="Policy12"/> 

      </behavior> 
     </serviceBehaviors> 

    </behaviors> 
</system.serviceModel> 

그리고는 다음과 같이 URL을 얻고 IIS에 게시 후 :

http://xxxx.com:8001/ACT/(S(2wpucy0oasurckuompimgqdo))/GetUser

때마다 토큰 유사 세그먼트 (S (2wpu cy0oasurckuompimgqdo)) 내가 IIS에 게시하면 동적으로 생성됩니다.

어디서 잘못 될지 모르겠습니다. IIS/코드에서 몇 가지 변경 작업을 수행해야하는지 여부는이 경우에만 가능합니다. IIS에 다시 게시 한 후에도 변경해서는 안되는 고정 URL이 필요합니다.

Global.asax.cs

public class Global : HttpApplication 
    { 
     void Application_Start(object sender, EventArgs e) 
     { 
      RegisterRoutes(); 
     } 

    private void RegisterRoutes() 
    { 
     // Edit the base address of Service1 by replacing the "Service1" string below 
     RouteTable.Routes.Add(new ServiceRoute("", new WebServiceHostFactory(), typeof(ACTServices))); 
    } 
} 

서비스 계약 :

namespace ACT 
{ 


    [ServiceContract] 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] 
public class ACTServices 
{ 


[OperationContract] 
    [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetUserData", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] 
    [FaultContract(typeof(ExceptionHandler))] 
    public List<UserData> GetUser(UserSearchCode searchcode) 
    { 
     try 
     { 

      return objRetrieveData.GetUserfromACT(searchcode.firstName, searchcode.lastName); 
     } 
     catch (Exception e) 
     { 
      ExceptionHandler eH = new ExceptionHandler(); 
      eH.status = "Error"; 
      eH.message = e.Message; 
      throw new WebFaultException<ExceptionHandler>(eH, HttpStatusCode.InternalServerError); 
     } 
     //return new List<UserData>(); 
    } 

    } 
} 
+0

- 추가 정보를 MSDN에서 다음 문서를 참조하십시오를 들어

<system.web> <sessionState mode="Off" /> </system.web> 

: 세션 상태를 사용하지 않도록 당신은 설정 파일에 다음을 추가 할 수 있습니다 ID가 URL에 추가되었습니다. 따라서 URL에서 제거하려면 세션 저장소를 비활성화하거나 쿠키로 이동해야합니다. –

+0

@IvanZub 그렇게하기위한 최선의 선택이 무엇인지 말해 줄 수 있습니까? 빠른 응답에 감사드립니다. – Deep

+0

나는 그냥 구성 파일에 다음을 추가 할 수 있습니다 생각 : 귀하의 제안이 근무하고있다 .. t에서

답변

0

는 "(S은 (2wpucy0oasurckuompimgqdo))"세션 ID가 URL에 추가됩니다. 따라서 URL에서 제거하려면 세션 저장소를 비활성화하거나 쿠키로 이동해야합니다. 나는. 세션입니다 "(S (2wpucy0oasurckuompimgqdo))"ASP.NET Session State Overview, Session-State Modes

관련 문제