Avatar of quanmac
quanmac asked on

Calling a Server App from a .net webpage

Hi there,

I am trying to call a server app from a .net webpage but this doesn't seem to be working. I've tested the code on a windows form app and it works great, but I'm not sure why it doesn't work on a webpage.

I've attached the code where I call the server app.
ServerLibrary.SendMail sendMail = (ServerLibrary.SendMail)Activator.GetObject(typeof(ServerLibrary.SendMail), "tcp://" + wbAppIP.wvValue + "/SendMail");
string results = sendMail.SendDISCPassword(invoiceNumber);

Open in new window

Editors IDEs.NET App Servers

Avatar of undefined
Last Comment
quanmac

8/22/2022 - Mon
ASKER
quanmac

Also, here is my web.config file with the system.net.remoting section added in.
<system.runtime.remoting>
    <application>
      <channels>
        <channel type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting" ref="tcp" secure="true" protectionLevel="EncryptAndSign" tokenImpersonationLevel="impersonation" useDefaultCredentials="True" username="My_Services" password="*******">
          <serverProviders>
            <formatter ref="binary" />
          </serverProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>

Open in new window

ASKER CERTIFIED SOLUTION
gregoryyoung

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
quanmac

Thanks gregoryyoung,

I changed the useDefaultCredentials to false and I still get the same result.
ASKER
quanmac

I've been trying to find examples but having no luck in getting this to work.

Here's what the web.config file part looks like now.
<system.runtime.remoting>
<application>
<client>
<wellknown url="tcp://" + AppServerIP + "/SendMail" type="MyServerLibrary.SendMail, MyServerLibrary" />
</client>
<channels>
<channel type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting" ref="tcp" secure="true" 
	 protectionLevel="EncryptAndSign" tokenImpersonationLevel="impersonation" useDefaultCredentials="False" 
	 username="MyServices" password="********">
  <serverProviders>
    <formatter ref="binary" />
  </serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
quanmac

I was able to get this to work when I added this in the Global.asax.cs file in Application_Start method:

System.Runtime.Remoting.RemotingConfiguration.Configure(Server.MapPath("Web.config"));

I got the page to work once, and now the server seems to be timing out ever since that.

Does anyone know why or should I open up a new question?
ASKER
quanmac

Seems like the server timing out was a network issue. Thanks for you help gregoryyoung