调用函数时Web服务出错 [英] Error in a Webservice when a function is call

查看:170
本文介绍了调用函数时Web服务出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在http:// localhost:999 / DE.Web / WCFServices / DE_Service.svc上没有可以接受该消息的端点。这通常是由错误的地址或SOAP操作引起的。有关详细信息,请参阅InnerException(如果存在)。



确定



There was no endpoint listening at http://localhost:999/DE.Web/WCFServices/DE_Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

OK

public string getData(string Args, string Table)// Friendly_Name, string Where, string User_Name, string Password)
        {
            //return Args;
            Dictionary<string,> _dt;
            Json json = new Json();
            _dt = (Dictionary<string,>)json.Deserialize(Args, typeof(Dictionary<string,>));
            try
            {
                if (_dt.ContainsKey("Request_For"))
                {
                    string Request_For = _dt["Request_For"];
                    #region Request_For == "Authentication"
                    if (Request_For == "Authentication")
                    {
                        string _User_Name_DE = _dt["User_Name"];
                        string Password_DE = _dt["Password"];
                        DataTable _dtUsers_DE = new DataTable();
                        _dtUsers_DE.Fill_DataTable_DE(@"SELECT * FROM [DivineCampus].[dbo].[" + Words_DE.Users_DE + @"] 
                    WHERE " + Words_DE.User_Name_DE + " = '" + _User_Name_DE + "'", Words_DE.CMS_DE);

                        if (_dtUsers_DE.Rows.Count > 0 && Password_DE == Basic_Functions_DE.Decrypt_Data_DE(_dtUsers_DE.Rows[0][Words_DE.Password_DE].ToString()))
                            return _dtUsers_DE.Rows[0][Words_DE.Contact_ID_DE].ToString();

                        else
                            return "Error : Invalid UserName Password";
                    }
                    #endregion

                    #region Request_For == "Data"
                    else if (Request_For == "Data")
                    {
                        string _Friendly_Name_DE = _dt["Friendly_Name"];
                        string _Where_DE = _dt["Where"];
                        DataSet _DS_DE = new DataSet();
                        DataTable _dt_DE;//= _DS_DE.Tables.Add();

                        Assembly _Assembly = Assembly.GetAssembly(typeof(AbsBC_DE));
                        string _DLL = Words_DE.DE_Divine_Campus + ".bc" + _Friendly_Name_DE;
                        Type _Type = _Assembly.GetType(_DLL);
                        AbsBC_DE _AbsBC_DE = Activator.CreateInstance(_Type, new object[] { new DataSet() }) as AbsBC_DE;
                        _dt_DE = _AbsBC_DE.getData_DE(Where_Clause_DE: _Where_DE, Select_Child_DE: true);
                        return json.Serialize(_AbsBC_DE.DS_DE);
                    }
                    #endregion

                    #region Request_For == "Structure"
                    else if (Request_For == "Structure")
                    {
                        string _Friendly_Name_DE = _dt["Friendly_Name"];

                        DataTable _dt_DE;

                        Assembly _Assembly = Assembly.GetAssembly(typeof(AbsBC_DE));
                        string _DLL = Words_DE.DE_Divine_Campus + ".bc" + _Friendly_Name_DE;
                        Type _Type = _Assembly.GetType(_DLL);
                        AbsBC_DE _AbsBC_DE = Activator.CreateInstance(_Type, new object[] { new DataSet() }) as AbsBC_DE;
                        _dt_DE = clsConnection.getModel_Data_DE(BusinessObj_DE: _AbsBC_DE, Where_Clause_DE: "1=2");
                        _dt_DE.Clear();
                        _AbsBC_DE.Add_New_Row_DE(null);
                        return json.Serialize(_AbsBC_DE.DS_DE);
                    }
                    #endregion

                    #region Request_For == "Transaction"
                    else if (Request_For == "Transaction")
                    {
                        string _Friendly_Name_DE = _dt["Friendly_Name"];
                        // string Table = _dt["Table"];
                        try
                        {
                            Json json1 = new Json();
                            DataSet _ds = new DataSet();
                            _ds = (DataSet)json.Deserialize(Table, typeof(DataSet));

                            DataTable _dt_DE;
                            Assembly _Assembly = Assembly.GetAssem





内部异常





Inner Exception

---------------------------
Error
---------------------------
The remote server returned an error: (404) Not Found.

   at System.Net.HttpWebRequest.GetResponse()

   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
---------------------------
OK   
---------------------------

推荐答案

错误消息本身表明Web服务存在一些问题通信(配置问题或连接问题)。



- >通过查看您的网址首先确认您是从服务所在的同一台计算机访问服务。如果不是这种情况,因为localhost存在于URL中,请使用正确部署服务的IP地址或计算机名称更改localhost。 (愚蠢的建议,但可能是个问题)。



- >第二件事请确认网址是否正确,并且您配置的网址没有问题您的浏览器。



- >第三件事是尝试访问 http:// localhost:999 / DE.Web / WCFServices / DE_Service.svc [ ^ ]服务从哪里运行你的代码通过在浏览器中粘贴上面的URL。



如果失败那么你的服务没有处于运行模式。



请检查以上步骤,如果仍未运行,则服务和消费者应用程序之间可能存在连接问题





希望它有帮助。
The Error Message itself depicts that there is some problem in web service communication(configuration problem or connection problem).

-->By seeing your url first confirms that you are accessing service from the same machine where your service is located. as localhost is present in URL if that is not the case then please change localhost with the ip address or machine name where exactly your service is deployed. (silly suggestion but might be a problem).

-->Second thing please verify that URL is correct and there is no problem with the URL u had configured in your browser.

--> Third thing try to access the http://localhost:999/DE.Web/WCFServices/DE_Service.svc[^] service from where u are runnning your code by pasting above url in your browser.

if it fails then your service is not in running mode.

Please check above steps and if it still not running then there might be some connection issue between service and consumer application


Hope it helps.


这篇关于调用函数时Web服务出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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