Click here to Skip to main content
15,907,000 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Scroll down in the grid view fetches next set of records without freezing the screen Pin
Alok Sharma ji16-Sep-12 19:04
Alok Sharma ji16-Sep-12 19:04 
QuestionChanging Name of File in File's Path Pin
ASPnoob14-Sep-12 12:59
ASPnoob14-Sep-12 12:59 
AnswerRe: Changing Name of File in File's Path Pin
Richard MacCutchan14-Sep-12 23:11
mveRichard MacCutchan14-Sep-12 23:11 
QuestionASP.NET Server Type application in PHP and ASP.NET MVC Pin
Rohit Kesharwani14-Sep-12 9:14
Rohit Kesharwani14-Sep-12 9:14 
QuestionRequest hangs in browser Pin
mrc250314-Sep-12 8:10
mrc250314-Sep-12 8:10 
AnswerRe: Request hangs in browser Pin
Alok Sharma ji16-Sep-12 19:07
Alok Sharma ji16-Sep-12 19:07 
GeneralRe: Request hangs in browser Pin
mrc250317-Sep-12 12:36
mrc250317-Sep-12 12:36 
QuestionCalling WCF Service within another WCF Service throwing eexception Pin
indian14313-Sep-12 14:50
indian14313-Sep-12 14:50 
Hi,

I have WCF ServiceA and WCF ServiceB. ServiceA is calling ServiceB. Both of them are using BasicHttp binding. But I am getting the exception with message as below. When I am trying to call the ServiceA and ServiceB individually from a test page both of them are working fine.
But I want to call ServiceB from ServiceA. I am not using the ServiceReference to call the serviceB I am calling the Service in the following way
Code to create the Service proxy
Imports System.ServiceModel
Imports System.ServiceModel.Web
Imports System.ServiceModel.Description
Public Class ServiceFactory(Of T)
    Public Shared Function GetBasicHttpChannelForService(ByVal source As String) As ChannelFactory(Of T)
        Dim factory As ChannelFactory
        Dim result = String.Empty
        Try
            'Get the channel from WCF
            Dim address As EndpointAddress = New EndpointAddress(source)
            Dim binding As BasicHttpBinding = New BasicHttpBinding()
            binding.MaxReceivedMessageSize = 2147483647
            binding.ReaderQuotas.MaxArrayLength = 2147483647
            binding.MaxBufferPoolSize = 2147483647
            binding.CloseTimeout = New System.TimeSpan(1, 1, 1)
            binding.OpenTimeout = New System.TimeSpan(1, 1, 1)
            binding.ReceiveTimeout = New System.TimeSpan(1, 1, 1)
            binding.SendTimeout = New System.TimeSpan(1, 1, 1)
            If factory Is Nothing Then
                factory = New ChannelFactory(Of T)(binding, address)
            ElseIf factory.State = CommunicationState.Closed Then
                factory = New ChannelFactory(Of T)(binding, address)
            ElseIf factory.State = CommunicationState.Faulted Then
                factory.Close()
                factory = New ChannelFactory(Of T)(binding, address)
            ElseIf Not factory.State = CommunicationState.Opened Then
                factory.Close()
                factory = New ChannelFactory(Of T)(binding, address)
            End If
        Catch ex As Exception
        End Try
        Return factory
    End Function

    Public Shared Sub CloseChannelFactory(ByRef factory As ChannelFactory)
        If Not factory Is Nothing Then
            If factory.State <> CommunicationState.Closed Then
                factory.Close()
            End If
            factory = Nothing
        End If
    End Sub
End Class

And in the test page's load even I am creating the Service proxy in the following way
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim factory As ChannelFactory(Of IStayAtWorkService)
        'GetMessages(New Guid("b14bc077-f1df-457c-9f7e-7cb9e0bc1cf3"))
        'Dim factory As ChannelFactory(Of IStayAtWorkService)
        Try
                factory = ServiceFactory(Of IStayAtWorkService).GetBasicHttpChannelForService _
            (ConfigurationManager.AppSettings("StayAtWorkServiceAddress"))
            Dim sawService As IStayAtWorkService = factory.CreateChannel()

            Dim inputFileBytes() As Byte
            Dim inputFile As String = ConfigurationManager.AppSettings("InputFiles")
            Using fstream = New FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
                Using br As BinaryReader = New BinaryReader(fstream)
                    inputFileBytes = br.ReadBytes(fstream.Length)
                    br.Close()
                End Using
                fstream.Close()
            End Using
            Dim fUpload As New RequestFile()
            fUpload.FileName = inputFile
            fUpload.FromDiv = "Accordian1"
            fUpload.ImageBytes = inputFileBytes
            fUpload.RequestId = 2
            Dim d = sawService.SaveRequestFile(fUpload)
            GridView1.DataSource = d
            GridView1.DataBind()
        Catch ex As Exception
        Finally
            ServiceFactory(Of IStayAtWorkService).CloseChannelFactory(factory)
        End Try
End Sub


Where am I missing, doesnt WCF support calling one service from another service or is it because I am creating service client for serviceB by using runtime mechanism. Please give me some solution. I would be really really thankful. When I am able to call individually why am I not able to call one service from another service. Please help me in fixing it. Following is the error message I am getting.

The remote server returned an unexpected respo
nse: (400) Bad Request.

And Stack TRace is :

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at WA.LNI.StayatWork.Service.IStayAtWorkService.SaveRequestFile(RequestFile fUpload)
   at WA.LNI.StayatWork.Public.UI.WebServiceTestPage.Page_Load(Object sender, EventArgs e) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayatWork.Public.UI\WebServiceTestPage.aspx.vb:line 157

Thanks & Regards,

Abdul Aleem Mohammad
St Louis MO - USA

Questiondebug web form page Pin
dcof13-Sep-12 8:55
dcof13-Sep-12 8:55 
AnswerRe: debug web form page Pin
David Mujica13-Sep-12 9:40
David Mujica13-Sep-12 9:40 
GeneralRe: debug web form page Pin
dcof14-Sep-12 6:57
dcof14-Sep-12 6:57 
QuestionMSChart with multi-datatables Pin
aransiola13-Sep-12 5:47
aransiola13-Sep-12 5:47 
AnswerRe: MSChart with multi-datatables Pin
Sandeep Mewara13-Sep-12 18:26
mveSandeep Mewara13-Sep-12 18:26 
GeneralRe: MSChart with multi-datatables Pin
aransiola24-Sep-12 4:34
aransiola24-Sep-12 4:34 
QuestionHi Pin
cunny13-Sep-12 2:09
cunny13-Sep-12 2:09 
AnswerRe: Hi Pin
Vani Kulkarni13-Sep-12 3:45
professionalVani Kulkarni13-Sep-12 3:45 
AnswerRe: Hi Pin
Abhinav S13-Sep-12 6:17
Abhinav S13-Sep-12 6:17 
Questionasd Pin
Member 878551213-Sep-12 1:32
Member 878551213-Sep-12 1:32 
QuestionTime slot booking application for room in hotel Pin
tarun0019712-Sep-12 23:37
tarun0019712-Sep-12 23:37 
AnswerRe: Time slot booking application for room in hotel Pin
Pete O'Hanlon12-Sep-12 23:57
mvePete O'Hanlon12-Sep-12 23:57 
AnswerRe: Time slot booking application for room in hotel Pin
Sandeep Mewara13-Sep-12 1:48
mveSandeep Mewara13-Sep-12 1:48 
AnswerRe: Time slot booking application for room in hotel Pin
Vani Kulkarni13-Sep-12 3:56
professionalVani Kulkarni13-Sep-12 3:56 
AnswerRe: Time slot booking application for room in hotel Pin
R. Giskard Reventlov13-Sep-12 5:17
R. Giskard Reventlov13-Sep-12 5:17 
Questionhow to retrieve value of dataset coloumn in c# Pin
km1711198312-Sep-12 21:30
km1711198312-Sep-12 21:30 
AnswerRe: how to retrieve value of dataset coloumn in c# Pin
Resam1112-Sep-12 22:29
Resam1112-Sep-12 22:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.