Показать сообщение отдельно
Старый 22.11.2013, 13:18   #1  
kh_heckfy is offline
kh_heckfy
Участник
 
139 / 14 (1) ++
Регистрация: 30.03.2012
Адрес: Новосибирск
CRM 2011 Авторизация Windows в asp.net
Вот код в сайте, простая страничка

X++:
 protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.IsAuthenticated)
                {
                    string username = HttpContext.Current.User.Identity.Name;
                    Response.Write(username);

                    Uri organizationUri = new Uri("http://nskdccrm/alventa/xrmservices/2011/Organization.svc");
                    //Authenticate using credentials of the logged in user;       
                    ClientCredentials Credentials = new ClientCredentials();
                    Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
                    //This URL needs to be updated to match the servername and Organization for the environment.
                    Uri HomeRealmUri = null;
                    //OrganizationServiceProxy serviceProxy;       
                    using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(organizationUri, HomeRealmUri, Credentials, null))
                    {
                        IOrganizationService service = (IOrganizationService)serviceProxy;

                        QueryExpression qe = new QueryExpression("systemuser");
                        qe.PageInfo = new PagingInfo() { Count = 10, PageNumber = 1 };
                        qe.ColumnSet = new ColumnSet("fullname", "domainname");
                        foreach (Entity user in service.RetrieveMultiple(qe).Entities)
                        {
                            Response.Write(string.Format("<br />{0} - {1}", user["fullname"], user["domainname"]));
                        }
                    }
                }
                else
                {
                    Response.Write("User is not authenticated");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
и у меня, когда я запускаю из студии все отрабатывает нормально
А когда ставлю на серваке
включаю только Windows авторизацию
происходит ошибка

Серверу не удалось обработать запрос из-за внутренней ошибки. Для получения дополнительной информации об ошибке включите IncludeExceptionDetailInFaults (или с помощью атрибута ServiceBehaviorAttribute, или из конфигурации поведения ) на сервере с целью отправки информации об исключении клиенту, либо включите трассировку, согласно документации Microsoft .NET Framework 3.0 SDK, и изучите журналы трассировки сервера.