1

I need to get the IP address of the client calling a function over a .NET Remoting TcpChannel. I found this post which seems to be exactly what I need, however, I am not sure how to implement this using the app.config file, which is a requirement for my project. I cannot find any good documentation on MSDN on how exactly the app.config file works in this case, likely because .NET Remoting is a legacy technology. Is there anybody who knows how I can implement the configuration code in the second section of Kev's answer using the app.config file?

Many thanks in advance for any help with this.

Community
  • 1
  • 1
codewario
  • 19,553
  • 20
  • 90
  • 159

1 Answers1

0

This answer worked wonders for me. I was able to implement this in the app.config file as follows:

<configuration>
   <system.runtime.remoting>
      <application>
         <channels>
            <channel ref="tcp" port="1234">
               <serverProviders>
                  <provider ref="clientinfo" />
                  <formatter ref="binary" />
               </serverProviders>
            </channel>
         </channels>
      </application>
      <channelSinkProviders>
         <serverProviders>
            <provider
               id="clientinfo"
               type="MyNameSpace.ClientInfoServerSinkProvider, MyAssemblyName" />
         </serverProviders>
      </channelSinkProviders>
   </system.runtime.remoting>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

I added the entire serverProviders element to the tcp channel, and added the entire channelSinkProviders element you see. Everything else was already there as an existing configuration we already had.

Community
  • 1
  • 1
codewario
  • 19,553
  • 20
  • 90
  • 159
  • I too implemented the referenced solution for accessing client IP address, but found that additional configuration was unnecessary. I didn't need the section, or the section in . (The other parts were already present.) – Ian Sep 18 '15 at 09:17