Quando um cliente é vinculado com o proxy DLL que gera a ferramenta Soapsuds (Soapsuds.exe), o cliente lança uma exceção remoting em tempo de execução. Você receberá uma mensagem de erro é semelhante a seguinte mensagem de erro:
Exceção não tratada: System.Runtime.Remoting.RemotingException: permissão negada para ativar tipo soap: TestClass, http://schemas.microsoft.com/clr/nsassem/EchoExeTest/ServerExe%2C%20Version%3D0.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull. Rastreamento de pilha do servidor: em System.Runtime.Remoting.Activation.ActivationListener.Activate(IConstructionCallMessage ctorMsg) no System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) no System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Use o bloco de notas para criar um novo arquivo de texto. Paste the following code in the file:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Metadata;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
namespace EchoExeTest{
[Serializable]
public class testObject
{
public int x;
public int y;
}
[Serializable]
public struct testStruct
{
public int x;
public int y;
}
public class Server {
public static int Main(string [] args) {
Server servObj = new Server();
servObj.Initialize(args);
System.Console.WriteLine("Press ENTER to exit.");
System.Console.ReadLine();
return 0;
}
public void Usage() {
Console.WriteLine(" Usage : ServerExe -chan:channel.config -mode:mode.config");
}
public int Initialize(string[] args) {
int ret=0;
if (args.Length == 0)
Usage();
for (int i=0;i<args.Length;i++) {
if (
String.Compare(args[i],"HELP", true) == 0 ||
String.Compare(args[i],"?", true) == 0 ||
String.Compare(args[i],"/h", true) == 0 ||
String.Compare(args[i],"-h", true) == 0 ||
String.Compare(args[i],"-?", true) == 0 ||
String.Compare(args[i],"/?", true) == 0
) {
Usage();
return -1;
}
String arg = args[i];
String value = null;
if (args[i][0] == '/' || args[i][0] == '-'){
int index = args[i].IndexOf(':');
if (index != -1) {
arg = args[i].Substring(1, index-1);
//Make sure that a colon (:) is not the last character.
if (index == (args[i].Length - 1))
throw new Exception("Argument cannot be empty -> " + args[i]);
value = args[i].Substring(index+1);
}
else
arg = args[i].Substring(1);
}
//Process the input sources.
if (String.Compare(arg, "chan", true) == 0) {
RemotingConfiguration.Configure(value);
}
else if (String.Compare(arg, "mode", true) == 0) {
RemotingConfiguration.Configure(value);
}
}
ret=100;
return ret;
}
}
public class TestClass : MarshalByRefObject {
public int EchoInt(int intval) {
Console.WriteLine("Method Called");
return intval;
}
public string EchoString(string strval) {
Console.WriteLine("Method Called");
return strval;
}
public DateTime EchoDateTime(DateTime dval) {
return dval;
}
public void voidFunc(){
return;
}
public int EchoParam(int intval) {
return intval;
}
public void SendParam(int intval) {
return;
}
public int GetParam() {
return 10;
}
public int EchoRefParam(ref int intval) {
intval++;
return 100;
}
public void SendRefParam(ref int intval) {
intval++;
return;
}
public void OutParam(out int intval) {
intval=100;
}
public testStruct echoStruct(testStruct ts) {
return ts;
}
public testObject echoObject(testObject to) {
Console.WriteLine("Method Called");
return to;
}
public int[] echoArray(int[] intArray) {
return intArray;
}
}
}
Salve o arquivo como ServerExe.cs .
Use o bloco de notas para criar um novo arquivo de texto. Cole o código a seguir no arquivo:
Para o Visual Studio .NET 2002, clique em Iniciar , aponte para programas , aponte para Microsoft Visual Studio. NET , aponte para Visual Studio .NET Tools e, em seguida, clique em Visual Studio .NET Command Prompt .
Para o Visual Studio .NET 2003, clique em Iniciar , aponte para programas , aponte para Microsoft Visual Studio .NET 2003 , aponte para Visual Studio .NET Tools e, em seguida, clique em Prompt de comando do Visual Studio .NET 2003 .
No prompt de comando, digite C: e, em seguida, pressione a tecla ENTER.
Digite Build.bat e, em seguida, pressione a tecla ENTER.
Execute o aplicativo de servidor de sistema de interação remota e o aplicativo de cliente do sistema de interação remota.
Você receberá a mensagem de erro mencionada na seção "Sintomas" deste artigo.
IMPORTANTE: Este artigo foi traduzido por um sistema de tradução automática (também designado por Machine Translation ou MT), não tendo sido portanto traduzido ou revisto por pessoas. A Microsoft possui artigos traduzidos por aplicações (MT) e artigos traduzidos por tradutores profissionais, com o objetivo de oferecer em português a totalidade dos artigos existentes na base de dados de suporte. No entanto, a tradução automática não é sempre perfeita, podendo conter erros de vocabulário, sintaxe ou gramática. A Microsoft não é responsável por incoerências, erros ou prejuízos ocorridos em decorrência da utilização dos artigos MT por parte dos nossos clientes. A Microsoft realiza atualizações freqüentes ao software de tradução automática (MT). Obrigado.
Clique aqui para ver a versão em Inglês deste artigo: 828987
Obrigado! Seus comentários são usados para nos ajudar a aperfeiçoar o conteúdo de suporte. Para obter mais opções de ajuda, visite a Home Page de Ajuda e Suporte.