如何在ASP.Net中通过我的手机发送短信 [英] How to send sms through my mobile in ASP.Net

查看:87
本文介绍了如何在ASP.Net中通过我的手机发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中使用以下代码从我的电脑发送短信,没有问题。



I use the following code in C# to send sms from my PC, there was no problem.

private SmsSubmitPdu pdu;
protected void btnSend_Click(object sender, EventArgs e)
{
    string port = "COM4";
    Int32 baudRate = 9600;

    GsmCommMain comm = new GsmCommMain(port, baudRate, 300);

    try
    {
        comm.Open();
        pdu = new SmsSubmitPdu("Hi I am Sayed", "01738169709", "");
        comm.SendMessage(pdu);
        comm.Close();
        lblError.Text = "Message sent";
    }

    catch (Exception ex)
    {
        lblError.Text = ex.ToString();
    }
}







But when I work on same code in ASP.net, then error have come in my label box.
Error:
"System.IO.FileNotFoundException: Could not load file or assembly 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' or one of its dependencies. The system cannot find the file specified. File name: 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' at GsmComm.GsmCommunication.GsmPhone.Open() at GsmComm.GsmCommunication.GsmCommMain.Open() at BRUR.Sms.A.btnSend_Click(Object sender, EventArgs e) in d:\@Projects\BRUR\BRUR\Sms\smsSending.aspx.cs:line 42 WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].





提前致谢。



Thanks in advance.

推荐答案

错误讯息非常明确:

The error message is quite explicit:
System.IO.FileNotFoundException: Could not load file or assembly 'GSMCommShared, Version=1.21.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' or one of its dependencies. The system cannot find the file specified.

您的服务器安装中似乎没有包含DLL。



我假设你意识到这只有在手机插入服务器而不是客户端时才有效吗?因为你会惊讶于有多少人不这么想......

It would appear that you have not included the DLL in your server installation.

I assume you realize that this will only work if the phone is plugged into the server, not the client? Because you'd be surprised how many people don't think about that...


这个错误非常自我解释 - 找不到装配GSMCommShared。

您必须确保GSMCommShared.dll文件位于GAC或您的webapp bin文件夹中。

您必须设置复制本地在您的装配参考上属性为True。
The error is pretty self explanatory - the assembly GSMCommShared was not found.
You have to make sure, that GSMCommShared.dll file is either in GAC or in your webapp bin folder.
You have to set "Copy Local" property to True on your assembly reference.


这篇关于如何在ASP.Net中通过我的手机发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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