Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cannot connect to custom gitlab server with different port #50

Closed
ytianxia6 opened this issue Apr 17, 2019 · 14 comments
Closed

cannot connect to custom gitlab server with different port #50

ytianxia6 opened this issue Apr 17, 2019 · 14 comments

Comments

@ytianxia6
Copy link

Installed product versions

  • Visual Studio: Visual Studio 2019 Enterprise Preview
  • This extension: 1.0.182

Description

I can not connect to my gitlab server.
our https port is 7443 and ssh port is 7022.

Steps to recreate

  1. install the plugin
    image

  2. Connect to GitLab
    image
    image

then I got the error:
image

  1. when use email to login:
    image

I got the error:
image

Current behavior

Expected behavior

how can i connect?

@maikebing
Copy link
Owner

maikebing commented Apr 18, 2019

Can I give me a test address and a user?

@ytianxia6
Copy link
Author

give me? I test on your server? Ok, you can send to me by mail or message.

@ytianxia6
Copy link
Author

I'm trying to clone the source code and debug it.
now i found it throw a exception in the GitLab.VisualStudio.Services.WebService.LoadProjects(), line 38, after some foreach.

I attemp to list the projects.

@ytianxia6
Copy link
Author

image
it throw a System.Net.WebException after about 20 times
image
image

Is it because my project is too much?

@maikebing
Copy link
Owner

give me? I test on your server? Ok, you can send to me by mail or message.

我写错了 。 如果你有测试账号, 可以给我一个, 我测试一下。

@ytianxia6
Copy link
Author

give me? I test on your server? Ok, you can send to me by mail or message.

我写错了 。 如果你有测试账号, 可以给我一个, 我测试一下。

呃,我编英语编的好累。。我发现其实连接是成功的,就是 LoadProjects 时,第21个异常。

@ytianxia6
Copy link
Author

give me? I test on your server? Ok, you can send to me by mail or message.

我写错了 。 如果你有测试账号, 可以给我一个, 我测试一下。

呃,我编英语编的好累。。我发现其实连接是成功的,就是 LoadProjects 时,第21个异常。

问题我已经找到了,但是不知道怎么修复
我在浏览器输入 https://my-server:7443/api/v4/projects/?membership=true,然后F12 调试查看 header,

link: <https://my-server/api/v4/projects?membership=true&order_by=created_at&owned=false&page=2&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="next", <https://appdev.zwcad.org.cn/api/v4/projects?membership=true&order_by=created_at&owned=false&page=1&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="first", <https://appdev.zwcad.org.cn/api/v4/projects?membership=true&order_by=created_at&owned=false&page=8&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="last"

在header中丢失了端口。

@ytianxia6
Copy link
Author

give me? I test on your server? Ok, you can send to me by mail or message.

我写错了 。 如果你有测试账号, 可以给我一个, 我测试一下。

呃,我编英语编的好累。。我发现其实连接是成功的,就是 LoadProjects 时,第21个异常。

问题我已经找到了,但是不知道怎么修复
我在浏览器输入 https://my-server:7443/api/v4/projects/?membership=true,然后F12 调试查看 header,

link: <https://my-server/api/v4/projects?membership=true&order_by=created_at&owned=false&page=2&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="next", <https://appdev.zwcad.org.cn/api/v4/projects?membership=true&order_by=created_at&owned=false&page=1&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="first", <https://appdev.zwcad.org.cn/api/v4/projects?membership=true&order_by=created_at&owned=false&page=8&per_page=20&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false>; rel="last"

在header中丢失了端口。

我检查过 gitlab 的 external_url 是正确的。

@ytianxia6
Copy link
Author

实在找不到解决方案,无奈之下,我修改了 NGitLabPlus 库,NGitLab.Impl.HttpRequestor.Enumerable.Enumerator 类,

                private int port;

                public Enumerator(string apiToken, Uri startUrl, ApiVersion _ApiVersion)
                {
                    this.apiToken = apiToken;
                    nextUrlToLoad = startUrl;
                    _apiVersion = _ApiVersion;

                    port = nextUrlToLoad.Port;
                }
                public bool MoveNext()
                {
                    if (buffer.Count == 0)
                    {
                        if (nextUrlToLoad == null)
                            return false;


                        if (nextUrlToLoad.Port != port)  // 修正端口
                        {
                            var ub = new UriBuilder(nextUrlToLoad);
                            ub.Port = port;
                            nextUrlToLoad = ub.Uri;
                        }

希望能有其它解决方案。

@maikebing
Copy link
Owner

修改之后解决了吗?

@ytianxia6
Copy link
Author

是的,这样修改替换后我可以使用了。
不方便的是这样每次安装我都得手动再替换个文件。。。。

@maikebing
Copy link
Owner

NGitLabPlus 我已经提交修改 ,我弄完后发布个版本。 你测试一下,如果没问题就发新版

@maikebing
Copy link
Owner

http://vsixgallery.com/extension/54803a44-49e0-4935-bba4-7d7d91682273/
@ytianxia6 下载这个 测试一下看有没有问题。

@ytianxia6
Copy link
Author

http://vsixgallery.com/extension/54803a44-49e0-4935-bba4-7d7d91682273/
@ytianxia6 下载这个 测试一下看有没有问题。

已经测试,没有问题。
另外建议加个 ESC 关闭窗口的功能,克隆、创建时,如果要取消,还要点击关闭按钮。

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants