Web服务在我的电脑上工作,但不适用于服务器电脑

问题描述 投票:0回答:1
System.InvalidOperationException: Missing parameter: AracMarka.
at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

我的WebMethot参数在我的电脑上运行。我写了一些东西并回复我,但我上传到服务器我的网络服务工作,但当ı调用metod并写入那里itgive错误Missing Parameter

我的电脑本地服务器,服务器和代码

c

[WebMethod]
public Bilgiler GetBilgiForMarka(String AracMarka, String AracModel, String Motor)
{
    string a = "Data Source=.;Initial Catalog=Android;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework";
    Bilgiler bilgilerimiz = new Bilgiler();

    SqlConnection conn = new SqlConnection(a);
    SqlCommand command = new SqlCommand("SELECT ID FROM [Android].[dbo].[KitAracModel] WHERE AracMarka='" + AracMarka + "' AND AracModel='" + AracModel + "' AND Motor='" + Motor + "'");
    command.Connection = conn;
    conn.Open();
    int ax = (int)command.ExecuteScalar();

    conn.Close();

    using (SqlConnection con = new SqlConnection(a))
    {
        SqlCommand cmd = new SqlCommand("SP_BILGILERIGET", con);
        cmd.CommandType = System.Data.CommandType.StoredProcedure;
        SqlParameter parametre = new SqlParameter();
        parametre.ParameterName = "@ID";
        parametre.Value = ax;
        cmd.Parameters.Add(parametre);
        con.Open();
        SqlDataReader DR = cmd.ExecuteReader();
        while (DR.Read())
        {

            bilgilerimiz.ID = Convert.ToInt32(DR["ID"]);
            bilgilerimiz.AracMarka = DR["AracMarka"].ToString();
            bilgilerimiz.AracModel = DR["AracModel"].ToString();
            bilgilerimiz.Motor = DR["Motor"].ToString();
            bilgilerimiz.Silindir = DR["Silindir"].ToString();
            bilgilerimiz.Guc = DR["Guc"].ToString();
            bilgilerimiz.KitAd = DR["KitAd"].ToString();
            bilgilerimiz.KitNo = DR["KitNo"].ToString();
        }
    }
    return bilgilerimiz;
}
c# sql-server web-services iis
1个回答
0
投票

看起来生成的请求在本地和服务器上是不一样的。我建议您在使用Fiddler等网络流量记录工具在本地和服务器上运行时匹配该请求。

© www.soinside.com 2019 - 2024. All rights reserved.