Jump to content


Photo

Erro Ao Publicar Webservice Wcf .Net 3.5


  • Faça o login para participar
2 replies to this topic

#1 leonecr

leonecr

    Novato no fórum

  • Usuários
  • 9 posts
  • Sexo:Masculino
  • Localidade:São Paulo

Posted 19/12/2010, 20:23

Ola a todos gostaria de que me ajudasse pois criei um WebService com WCF com framework .net 3.5 o serviço é muito simples sem acesso a banco de dados ou dlls de terceiros e sem acesso a pasta ou diretório e só função de calcular peso e altura da pessoa.Que fiz para teste de aprendizado, testei localmente no meu iis do windows xp funcionou normalmente porem quando coloquei na minha hospedagem do meu site deu erro. Fiz todo normal transferir via FTP e criei aplicação no painel da hospedagem da KINGHOST e configurei para rodar o framework .net 3.5 .
ABAIXO o erro:
Esta coleção já contém um endereço com o esquema http. Pode haver no máximo um endereço por esquema nesta coleção.
Nome do parâmetro: item
Pagina do erro: http://leonecostaroc...oEnfermaria.svc
CODIGOS:::
INTERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

// NOTE: If you change the interface name "IService" here, you must also update the reference to "IService" in Web.config.
[ServiceContract]
public interface IMeuServicoEnfermaria
{
[OperationContract]
double CalcularIMC(IMC imc_);

[OperationContract]
string EstadoPaciente(TriagemCardicaTemperatura tct_);
}

// Use a data contract as illustrated in the sample below to add composite types to service operations.

[DataContract]
public class IMC
{
private double altura;
private double peso;
private double resultado;

[DataMember]
public double Altura
{
get { return altura; }
set { altura = value; }
}

[DataMember]
public double Peso
{
get { return peso; }
set { peso = value; }
}

[DataMember]
public double Resultado
{
get { return resultado; }
set { resultado = value; }
}

}

[DataContract]
public class TriagemCardicaTemperatura
{
private int batimentoCardiaco;
private double temperatura;
private String resultadoTriagem;

[DataMember]
public int BatimentoCardiaco
{
get { return batimentoCardiaco; }
set { batimentoCardiaco = value; }
}

[DataMember]
public double Temperatura
{
get { return temperatura; }
set { temperatura = value; }
}
[DataMember]
public String ResultadoTriagem
{
get { return resultadoTriagem; }
set { resultadoTriagem = value; }
}

}
CODIGO QUEIMPLEMENTA A CLASSE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

// NOTE: If you change the class name "Service" here, you must also update the reference to "Service" in Web.config and in the associated .svc file.
public class MeuServicoEnfermaria : IMeuServicoEnfermaria
{


#region METODO CALCULAR IMC IService Members
/// <summary>
/// Este metodo calcula o IMC no qual utiliza a formula peso divido po altura vezes altura
/// </summary>
/// <param name="imc_">este medo recebe propriedades peso e altura do objeto imc_</param>
/// <returns></returns>
double IMeuServicoEnfermaria.CalcularIMC(IMC imc_)

{

try
{
imc_.Resultado = imc_.Peso / (imc_.Altura * imc_.Altura);
}
catch (Exception )
{
imc_.Resultado = 0;
}
return imc_.Resultado;
}


#endregion

#region IService Members


string IMeuServicoEnfermaria.EstadoPaciente(TriagemCardicaTemperatura tct_)
{
try
{
if ( (tct_.BatimentoCardiaco < 120 ) && (tct_.Temperatura < 37.00))
{
tct_.ResultadoTriagem = "Você está Saudavel";
}
if ((tct_.BatimentoCardiaco >= 120) && (tct_.Temperatura < 37.00))
{
tct_.ResultadoTriagem = "Vá para o Cardiologista";
}
if ((tct_.BatimentoCardiaco < 120) && (tct_.Temperatura >= 37.00))
{
tct_.ResultadoTriagem = "Vá para o Ambulatorio";
}

}
catch (Exception )
{
tct_.ResultadoTriagem = "Vá para o Pronto Socorro";
}
return tct_.ResultadoTriagem;
}

#endregion
}


CODIGO QUE CONSOME
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnCalcIMC_Click(object sender, EventArgs e)
{
//INSTACIO A CLASSE DO SERVICO
ServicoWCF.IMC imc = new ServicoWCF.IMC();
imc.Altura = double.Parse(this.txtAltura.Text);
imc.Peso = double.Parse(this.txtPeso.Text);

ServicoWCF.MeuServicoEnfermariaClient clienteWCF = new ServicoWCF.MeuServicoEnfermariaClient();

double valorIMC = clienteWCF.CalcularIMC(imc);

if (valorIMC < 20.0)
{
lblIMC.Text = valorIMC.ToString() + " - Abaixo do Peso";
}
if (valorIMC > 20.0 && valorIMC < 25.0)
{
lblIMC.Text = valorIMC.ToString() + " - Peso Ideal";
}
if (valorIMC > 25.0 && valorIMC < 30.0)
{
lblIMC.Text = valorIMC.ToString() + " - Sobrepeso";
}
if (valorIMC > 30.0 && valorIMC < 35.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Moderada";
}
if (valorIMC > 35.0 && valorIMC < 40.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Severa";
}
if (valorIMC > 40.0 && valorIMC < 50.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Mórbida";
}
if (valorIMC > 50.0)
{
lblIMC.Text = valorIMC.ToString() + " - Super Obesidade";
}
//lblIMC.Text = clienteWCF.CalcularIMC(imc).ToString();

}
protected void btnAvaliarEstado_Click(object sender, EventArgs e)
{
ServicoWCF.TriagemCardicaTemperatura triagem = new ServicoWCF.TriagemCardicaTemperatura();

triagem.Temperatura = double.Parse(this.txtTP.Text);
triagem.BatimentoCardiaco = int.Parse(this.txtBC.Text);
ServicoWCF.MeuServicoEnfermariaClient clienteEstadoPAcienteWS = new ServicoWCF.MeuServicoEnfermariaClient();

lblEstadoPaciente.Text = clienteEstadoPAcienteWS.EstadoPaciente(triagem);

}
}

Attached Files



#2 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 13/11/2017, 18:06

Find Provera. Discount Generic Provera Cycrin Without Dr Approval Drugs Finasteride Find Prezzo Cialis Italia viagra Dutasteride Australia Mastercard Accepted With Overnight Delivery Pharmacy
Where To Buy Misoprostol Online Cytotec Sans Ordonnance Pharmacie Cialis 20 Mg Gold viagra Achat Vardenafil Mexican Pharmacy No Prescription Needed
Amoxicillin And Chewable Tablets accutane online for sale mail order levitra 90 day supply No Rx Discount Propecia Buy Viagra 100mg Secure Tabs

#3 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 20/11/2017, 08:49

Cheap Clomid In The Usa Noble Drugs Canada Cialis Preise In Deutschland cheapest generic levitra Buy Meloxicam 7.5 Mg Propecia Proscar Finasteride Prix Propecia Nancy




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq