是否可以远程实例化Web应用程序的Bin文件夹中的对象? [英] Is it possible to instantiate an object in Bin folder of a web application remotly?

查看:59
本文介绍了是否可以远程实例化Web应用程序的Bin文件夹中的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的本地计算机上有一个控制台应用程序,我想在其中使用

远程处理,在网络中实现一个对象(MyClass.dll)

应用程序(它的bin文件夹)在一个完全独立的盒子里(在同一个域中

想到)。我有两个问题:


1)我的案例是否涵盖在Remoting IIS中托管的对象主题?它们是否相同?


2)我应该如何从我的控制台应用程序对IIS进行身份验证?我是否真的需要在实例化对象之前对IIS进行身份验证?

感谢您的帮助。

解决方案
> 1)我的案例是否包含在远程处理IIS中托管的对象中话题?

他们一样吗?


不确定 - 您对设置的描述有点不清楚。托管远程处理

IIS和ASP.NET中的对象意味着你已经将你的MarshalByRefObject派生的

类转移到〜/ bin中的程序集中了配置web.config以提供

那些.rem或.soap端点。我不确定你的控制台应用程序如何适用于这张图片,除非它是远程客户端应用程序。

2)我应该如何从我的IIS验证控制台应用?在实例化对象之前,我是否真的需要对IIS进行身份验证?




啊,所以控制台应用程序是客户端。那么在透明代理上,你可以通过((感谢Mike Woodring为此提示)设置凭证):


//假设tp是你的透明代理

IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);

//这使用您的客户端应用程序的凭据

chanProps [" ;凭证"] = CredentialCache.DefaultCredentials;

//或者如果您有明文密码,则显式设置它们

chanProps [" credentials"] = new NetworkCredential(userName,密码);


Ick。超级ick。 Ick Ick Ick。


-Brock

DevelopMentor
http://staff.develop.com/ballen



>不确定 - 您对设置的描述有点不清楚。托管

从IIS和ASP.NET中远程控制对象意味着您已将您的MarshalByRefObject派生类转移到〜/ bin中的程序集并且您已经
配置web.config以提供.rem或.soap端点。我不确定你的控制台应用程序如何适合这张图片,除非它是
远程客户端应用程序。




是的,我想在dll文件中使用的类派生自

MarshalByRefObject,程序集位于web

应用程序的bin文件夹中。控制台应用程序是一个应用程序,将要实例化该类并使用其中一种方法来执行某些操作。对象

由IIS托管。我认为已经说过,这意味着控制台

应用程序是远程客户端应用程序,IIS托管远程对象。

是吗?你在回复中提到了web.config。你提到的网页配置是什么?b / b
让我们假设这一切都已完成。我会一直看到我的控制台应用程序中最新版本的远程

对象,对吗?并且我不需要明确地引用它

或者担心编译我的客户端应用程序时他们编译了

远程处理对象,对吗?

谢谢你的回复。

" Brock Allen" < BA **** @ NOSPAMdevelop.com>在消息中写道

news:64 ********************** @ msnews.microsoft.com ...

1)我的案例是否包含在远程处理IIS中托管的对象中?主题?它们是否相同?



不确定 - 您对设置的描述有点不清楚。从IIS和ASP.NET中托管远程对象意味着您已经将您的MarshalByRefObject派生类转移到〜/ bin中的程序集并且已经配置了web.config为.rem或.soap端点提供服务。我不确定你的控制台应用程序如何适合这张图片,除非它是
远程客户端应用程序。

2)我应该如何验证从我的控制台应用程序到IIS?在实例化对象之前,我真的需要对IIS进行身份验证吗?



啊,所以控制台应用程序就是客户端。那么在透明代理上你可以通过((Thx到Mike Woodring为这个提示)设置凭证):

//假设tp是你的透明代理
IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);
//这会使用您的客户端应用程序的凭据
chanProps [" credentials"] = CredentialCache.DefaultCredentials;
//或者这会明确地设置它们如果您有明文密码
chanProps [" credentials"] = new NetworkCredential(userName,password);

Ick。超级ick。 Ick Ick Ick。

-Brock
DevelopMentor
http://staff.develop.com/ballen



>让我们假设这一切都完成了。我总是会在我的控制台应用程序中看到最新版本的

远程对象,对吧?而且我不需要参考它显而易见或担心编译我的客户端应用程序,他们编译远程对象,对吗?




只要客户端和服务器共享一些通用的元数据格式,那么

是的,这将起作用。建议的方法是使用接口作为

公共元数据格式。 IOW,这是客户端和

服务器之间的共享API。这基本上意味着你的MBRO应该配置为
作为WellKnown对象类型。你是否决定将它作为SingleCall或Singleton配置

取决于你。请注意,单身是一种误称。它只是

意味着任何时候都只有一个实例,但随着时间的推移,它可能是一个不同的实例。


-Brock

DevelopMentor
http:/ /staff.develop.com/ballen


I have a console application in my local computer which I like to use
remoting in it,to instanciate an object (MyClass.dll) in a web
application(its bin folder) in a completely seperated box(in the same domain
thought) .I have two questions:

1)Is my case covered in "Remoting objects hosted in IIS" topic?Are they
same?

2) How should I authenticate to IIS from my console application? Do I really
need to authenticate to IIS before instantiating the object?
Thanks for your help.

解决方案

> 1)Is my case covered in "Remoting objects hosted in IIS" topic?Are

they same?
Not sure -- your description of the setup is a little unclear. Hosting remoting
objects out of IIS and ASP.NET means you''ve delpoyed your MarshalByRefObject-derived
classes to an assembly in the ~/bin and you''ve configured web.config to serve
those up as .rem or .soap endpoints. I''m not sure how your console app fits
into this picture unless it''s the remoting client application.
2) How should I authenticate to IIS from my console application? Do I
really need to authenticate to IIS before instantiating the object?



Ah, so the console app is the client. So then on the transparent proxy you
can set the credentials via ((Thx to Mike Woodring for this tip)):

// assuming tp is your transparent proxy
IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);
// this uses your client app''s credentials
chanProps["credentials"] = CredentialCache.DefaultCredentials;
// or this sets them explicitlly if you have plaintext password
chanProps["credentials"] = new NetworkCredential(userName, password);

Ick. Super ick. Ick Ick Ick.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Not sure -- your description of the setup is a little unclear. Hosting

remoting objects out of IIS and ASP.NET means you''ve delpoyed your
MarshalByRefObject-derived classes to an assembly in the ~/bin and you''ve
configured web.config to serve those up as .rem or .soap endpoints. I''m
not sure how your console app fits into this picture unless it''s the
remoting client application.



Yes,The class I want to uuse within the dll file is derived from
MarshalByRefObject and the assembly is in the bin folder of the web
application.The console application is an application which is going to
instantiate that class and uses one of its method to do something.The object
is hosting by IIS.I think having said this ,it means that console
application is remoting client app and IIS hosts the remote object.
Is that right? You mentioned web.config in your reply.which web config are
you refering to?

Let''s assume all this done.I would always see the latest version of remote
object in my console app,right? and I do not need to reference it explicity
or be worried about compiling my client app whenevr they compile the
remoting object ,right?
Thanks for your reply.
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...

1)Is my case covered in "Remoting objects hosted in IIS" topic?Are
they same?



Not sure -- your description of the setup is a little unclear. Hosting
remoting objects out of IIS and ASP.NET means you''ve delpoyed your
MarshalByRefObject-derived classes to an assembly in the ~/bin and you''ve
configured web.config to serve those up as .rem or .soap endpoints. I''m
not sure how your console app fits into this picture unless it''s the
remoting client application.

2) How should I authenticate to IIS from my console application? Do I
really need to authenticate to IIS before instantiating the object?



Ah, so the console app is the client. So then on the transparent proxy you
can set the credentials via ((Thx to Mike Woodring for this tip)):

// assuming tp is your transparent proxy
IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);
// this uses your client app''s credentials
chanProps["credentials"] = CredentialCache.DefaultCredentials;
// or this sets them explicitlly if you have plaintext password
chanProps["credentials"] = new NetworkCredential(userName, password);

Ick. Super ick. Ick Ick Ick.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Let''s assume all this done.I would always see the latest version of

remote object in my console app,right? and I do not need to reference
it explicity or be worried about compiling my client app whenevr they
compile the remoting object ,right?



As long as the client and server share some common metadata format, then
yes, this will work. The recommended approach is to use an interface as the
common metadata format. IOW, that''s the shared API between the client and
server. This then will basically mean that your MBRO should be configured
as a WellKnown Object type. It''s up to you whether you decide to configure
it as SingleCall or Singleton. Mind you, singleton is a misnomer. It just
means there''s only evenr one instance at any one time, but it could be a
different instance over time.

-Brock
DevelopMentor
http://staff.develop.com/ballen


这篇关于是否可以远程实例化Web应用程序的Bin文件夹中的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆