2013-01-23 7 views
0

사전 제작 환경에 배포 할 때 WCF 문제가 있습니다. 로컬에서 잘 작동합니다. 내가받는 AJAX 메시지는 구문 분석 오류가 있지만 선행 서버에서 로깅 기록을 가져올 수 없지만 동일한 로컬 설정 (동일한 웹 구성 설정)에서 로깅이 제대로 작동한다는 것입니다.
Traces.svlog가 preprod에 기록하는 유일한 시간은 앱 도메인이 언로드 될 때입니다. 내 지역에서는 고의적 인 예외를 던질 수 있으며 로그에 표시됩니다.로그인 한 후 WCF 서비스에 액세스 할 수 없습니다.

로그인 한 경우 서비스 경로로 이동할 수 없으며 대신 예외가 발생합니다 (아래 참조). 그러나 로그인하지 않으면 서비스 페이지에 액세스하여 wsdl을 클릭하고 메소드 등을 볼 수 있습니다. 로그인 후 잘못된 점을 알고 있습니다.

예외 : 우리는 preprod 환경에 IIS6을 실행하는

Process information: 
Process ID: 4796 
Process name: w3wp.exe 
Account name: NT AUTHORITY\NETWORK SERVICE 

Exception information: 
Exception type: InvalidCastException 
Exception message: Unable to cast object of type 
System.ServiceModel.Activation.HttpHandler' to type 'System.Web.UI.Page'. 

Request information: 
Request URL: http://100.100.100.104/Application/Webservices/People.svc/GetAllActive 
Request path: /Application/Webservices/People.svc/GetAllActive 
User host address: 102.24.1.152 
User: 
Is authenticated: False 
Authentication Type: 
Thread account name: domainA\userB 

Thread information: 
Thread ID: 7 
Thread account name: domainA\userB 
Is impersonating: True 
Stack trace: at ASP.global_asax.Application_PreRequestHandlerExecute 
       (Object sender, EventArgs e) 
at 
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

.

처음에는 IISManager -> AppplicationProperies-> HomeDirectory-> Configuration에 svc 확장이 없다는 것을 알았습니다. 나는 그것을 수동으로 추가했다. 그들이 오류를 해결하기 위해 아무것도하지 않았다, 다시

aspnet_regiis -i 

ServiceModelReg.exe -i 

: 때문에 나는 다른 곳에서 읽은 것에이 따라하고

, 또한 올바른 위치에서 다음 두 명령을 실행했습니다.

내 주요 혼란은 URL에 입력 할 수 있고 내가 로그인하지 않은 한 svc wsdl에 액세스 할 수 있다는 것입니다. 위의 오류 메시지에서 볼 수 있듯이 우리의 webconfig는 가장을 사용하고 있습니다. 효과.

내 서비스 디렉토리 구조체는 같은

Calling.aspx에 내 AJAX 호출이 보이는
Application 
->AppCode 
...->People.vb 
->DirA 
...->DirB 
......->Calling.aspx 
->WebServices 
...->People.svc 

다음

jQuery_1_8_3(document).ready(function() { 

    jQuery_1_8_3.ajaxSetup({ 
     data: "{}", 
     dataType: "json", 
     type: "POST", 
     contentType: "application/json", 
     converters: { 
      "json jsond": function(msg) { 
       return msg.hasOwnProperty('d') ? msg.d : msg; 
      } 
     } 

    }); 


    jQuery_1_8_3.ajax({ 
    url: "../../Webservices/People.svc/GetAllActive", 
     success: function(resdata) { 

      //etc 
     } 
    }); 

SVC를 보이는 등 다음

을 그리고 내 Vb는 다음과 같습니다 :

<ServiceContract(Namespace:="people")> _ 
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _ 
Public Class People 

<CLSCompliant(False)> _ 
<OperationContract()> _ 
<WebInvoke(BodyStyle:=WebMessageBodyStyle.Wrapped, RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)> _ 
Public Function GetAllActive() As PersonDetailDataContract() 
    Dim service As New RepositoryService() 
    Dim personList As IList(Of Interfaces.ModelInterfaces.IPersonDetail) 
    personList = service.GetAllPersonDetails() 

    Dim contractList As New ArrayList() 

    For Each 
    //Populate contractlist, etc 
    Next 

    Dim array() As PersonDetailDataContract 
    array = contractList.Cast(Of PersonDetailDataContract)().ToArray() 

    Return array 

End Function 

End Class 

자세히 알 수 있듯이 계약서에 별도의 인터페이스를 만들지 않으려 고합니다. 구체적인 클래스에 배치했습니다.

(코드와 IP 등도 익명으로 처리했습니다.) 다음 (마이너스가 다른 애플 리케이션을위한 다른 것들의 거대한 무리로

내 Webconfig는. 내가 여기 난처한 상황에 빠진의 종류지고있어

<system.diagnostics> 
    <trace autoflush="true" /> 

    <sources> 
     <source name="System.ServiceModel" 
       switchValue="Information, ActivityTracing" 
       propagateActivity="true"> 
      <listeners> 
       <add name="traceListener" 
        type="System.Diagnostics.XmlWriterTraceListener" 
        initializeData= "C:\svclogs\Traces.svclog" /> 
      </listeners> 
     </source> 
    </sources> 
</system.diagnostics> 
<system.serviceModel> 
    <diagnostics> 
     <messageLogging 
      logMessagesAtTransportLevel="true" 
      logMessagesAtServiceLevel="true" 
      logMalformedMessages="true" 
      logEntireMessage="true" 
      maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" /> 
    </diagnostics> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="PeopleTypeBehaviors" > 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
      <behavior name="json"> 
       <webHttp/> 

      </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <services> 
     <service name="People" behaviorConfiguration="PeopleTypeBehaviors"> 

      <endpoint address="" 
        behaviorConfiguration="json" 
        binding="webHttpBinding" 
        contract="People" /> 
      <endpoint contract="IMetadataExchange" 
        binding="mexHttpBinding" 
        address="mex" /> 
     </service> 
    </services> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
</system.serviceModel> 

을보고, 나는 어떤 종류의 웹 서비스에 아주 새로운 해요 . 그러나, 나는 다른 사람들이 아마도 문제를 볼 수 있도록 내가 충분한 정보를 제공 한 바랍니다.

어떤 도움이 많이 이해할 수있을 것이다.

감사합니다.

답변

0

답변 (! 단서가 반전 예외에 있었다 - DOH)이 global_asax.Application_PreRequestHandlerExecute에 문제가 있다고했다

절차가 분명히으로되지 않은, 페이지에 핸들러를 캐스팅하려고 시도했습니다 아약스 요청이었다. 대신 캐스트 처리기 호출에 trycast를 넣었고 나머지 프로 시저는 요청을 반환하여 결과를 반환하도록 무시되었습니다.

관련 문제