简体   繁体   English

Salesforce中的ASP.net登录超时

[英]ASP.net login timed out in salesforce

I want to use the Enterprise WSDL service of Salesforce in my ASP.net application to import/export data to/of salesforce. 我想在我的ASP.net应用程序中使用Salesforce的Enterprise WSDL服务将数据导入到Salesforce中或从中导出数据。 The service is already imported in my project as Service Reference and I can create Salesforce objects in my code behind(c#) 该服务已作为服务引用导入到我的项目中,并且我可以在后面的代码中创建Salesforce对象(C#)

But when I try to login via the application, I get this timeout error: 但是,当我尝试通过应用程序登录时,出现此超时错误:

Message: The request channel timed out attempting to send after 00:01:00. 消息:请求通道超时,尝试在00:01:00之后发送。 Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. 增加传递给请求的调用的超时值,或者增加绑定上的SendTimeout值。 The time allotted to this operation may have been a portion of a longer timeout. 分配给该操作的时间可能是较长超时的一部分。

Source: mscorlib 资料来源:mscorlib

Type: System.TimeoutException 类型:System.TimeoutException

My guess is that I need to setup a proxy to the Salesforce request, so does anybody know how to retrieve this? 我的猜测是我需要为Salesforce请求设置代理,所以有人知道如何检索该代理吗?

This is what I have so far: 这是我到目前为止的内容:

using (enterprise.SoapClient loginClient = new enterprise.SoapClient("Soap"))
        {
            string sfPassword = "password";
            string sfUsername = "my@email.com";

            enterprise.LoginResult result = loginClient.login(null, sfUsername, sfPassword);

            output.InnerHtml = "SessionID: " + result.sessionId + "<br />" +
                                "SessionURL: " + result.serverUrl;

        }

Edit: 编辑:

https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_login.htm https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_login.htm

Found this page which contains a code snippet to use a proxy. 找到此页面,其中包含使用代理的代码段。 But the problem is that I don't have a ConnectorConfig or EnterpriseConnection at choice. 但是问题是我没有选择ConnectorConfig或EnterpriseConnection。 Seems that this is the JAVA code, but I need the C# samples. 似乎这是JAVA代码,但是我需要C#示例。 Any ideas? 有任何想法吗?

Thanks, Michael 谢谢迈克尔

Added the Network Credentials line 添加了“网络凭据”行

using enterprise = NamespaceName.WebReferenceName;
using proxy = System.Net.WebProxy;
using System.Net;

protected void Page_Load(object sender, EventArgs e)
{
        enterprise.SforceService sforceService = new enterprise.SforceService();
        proxy wp = new proxy("StringOfHost", 9999); //Host, Port
        wp.Credentials = new NetworkCredentials("username", "password");
        sforceService.Proxy = wp;
        enterprise.LoginResult loginResult = sforceService.login(sfUsername, sfPwd);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM