Tag: .net

无法将Npgsql连接到在Docker上运行的Postgres DB

我有一个与以下代码的.NET应用程序的docker容器: var pgsql = OpenDbConnection("Server=localhost;Database=postgres;Username=postgres;Password=MyPass;Port=5432"); private static NpgsqlConnection OpenDbConnection(string connectionString) { NpgsqlConnection connection; Console.Error.WriteLine("Connecting to DB"); while (true) { try { connection = new NpgsqlConnection(connectionString); connection.Open(); break; } catch (SocketException e) { Console.WriteLine("{0} Exception caught.", e); Thread.Sleep(1000); } catch (DbException) { Console.Error.WriteLine("Waiting for db – db error"); Thread.Sleep(1000); } } return connection; } 我有一个不同的容器与官方Postgres容器,我开始与命令 docker […]

在Docker中为自己的容器.Net Core应用程序指定运行时

我正在研究.Net核心应用程序,我的目标是在docker集装箱中生产。 我的目标是netcoreapp1.0框架。 在官方.Net Core SDK图像中构build和运行应用程序时,一切都按预期工作。 下一步是拥有一个自包含的应用程序,并使用来自Microsoft的官方运行时镜像,而不是像他们在这里推荐的那样。 我所知道的是你必须指定你想要包含在你的project.json的runtime section的runtime section 。 我的问题是: microsoft/dotnet:runtime使用哪个运行microsoft/dotnet:runtime ,为他们的最新的图像版本? 有很多不同的,即Ubuntu运行时目标可以从Microsoft Docs网站select: ubuntu.14.04-64 ubuntu.14.10-64 ubuntu.15.04-64 ubuntu.15.10-64 ubuntu.16.04-64 ubuntu.16.10-64 该应用程序将作为Linux容器运行,而不是Windows容器。

我可以使用docker在OSX上运行MSBuild吗?

在工作中,我们有一个大的JS(FrontEnd)/ .NET(后端)项目。 我想有一个select,在家里的Mac上的项目。 我可以在同一个项目中使用docker在PC和Mac上工作吗? 我被告知,目前的系统不适合经典的.NET,只针对.NET核心进行了优化。 那是对的吗?

两个运行.NET服务的docker节点,彼此交谈

我的问题是关于容器的.NET World中的应用程序体系结构。 我去了一个本地的.NET Development Meetup ,那个人展示了如何重新构build我们的应用程序,以适应所有组件到不同的容器中。 我喜欢这个主意,回到家里意识到沟通部分是如何发挥的。 这是他写的东西。 每个泡泡代表一个容器。 现在这是百万美元的问题。 我的应用程序是一个ASP.NET MVC Web App ,业务逻辑和数据访问层是应用程序引用的DLL。 其他则在每个依赖层上创build一个REST端点; 我没有看到没有其他方式我的DLL可以在一个单独的容器中运行,并通过容器行引用。 .NET提供的方法/框架能够轻松完成吗?

剖析Docker容器上运行的C#点networking应用程序

我正在寻找一种C#Dot Net的开源分析工具,可以剖析Docker容器内运行的C#点networking代码,并发布CPU,磁盘和networking统计信息,以帮助识别代码中的瓶颈。 任何build议将是有益的。谢谢。

Ubuntu上的Docker .Net Core应用程序不在localhost:8000中打开

我正在使用Ubuntu 16.04,我在Windows上有一个.Net Core的docker应用程序,并试图让它在Ubuntu上运行。 我有docker和.net核心运行没有错误。 当我运行“sudo docker-compose up”时,它运行服务器,正在监听“ http:// +:80” 。 但是我无法在浏览器中打开它。 在Windows上,我正在使用的每个人都可以在localhost:8000上加载它。 当我运行docker-compose时,这是我得到的: sudo docker-compose up Starting webui Starting projects_api Starting profile_api Starting identity_api Attaching to projects_api, profile_api, webui, identity_api profile_api | Hosting environment: Development profile_api | Content root path: /app projects_api | Hosting environment: Development profile_api | Now listening on: http://+:80 projects_api | Content […]

无法在.Net Core API中连接到Mongo DB

一直在使用.Net核心networking应用程序,现在我想连接Mongo与在.Net核心上编写.Net C#的api。 但是,一切都在Docker里面。 这就是说,每个元素都在工作。 我可以从命令行编辑数据库,所以我知道它的启动和运行。 另外,我应该注意到我在最新的Ubuntu上。 在.csproj文件中,我添加了Mongo驱动程序: <PackageReference Include="MongoDB.Driver.Core" Version="2.3.0" /> <PackageReference Include="MongoDB.Bson" Version="2.3.0" /> 然后在program.cs文件中添加: using MongoDB.Driver; // at top using MongoDB.Bson; … … var mongo = MongoClient("mongodb://localhost:27017"); // in main method 这是我使用docker构build应用程序时得到的错误: Program.cs(13,25): error CS0103: The name 'MongoClient' does not exist in the current context [/src/src/Identity.api/Identity.api.csproj] 我添加了正确的驱动程序,他们是否在错误的位置? 让我知道是否需要任何额外的信息。 非常感谢,我期待能够连接到数据库!

在RHEL-.NET Core上,对project.lock.json的访问被拒绝

我刚刚开始使用Red Hat提供的一些说明,在RHEL 7上使用.NET Core和Docker。 我使用dotnet new -t web创build了一个.NET核心MVC应用程序,然后在该文件夹中创build了我的Dockerfile ,其中包含以下内容: FROM registry.access.redhat.com/dotnet/dotnetcore-11-rhel7 ADD . /opt/app-root/src/ WORKDIR /opt/app-root/src/ EXPOSE 5000 RUN ["/bin/bash", "-c", "/opt/rh/rh-dotnetcore11/root/usr/bin/dotnet restore"] RUN ["/bin/bash", "-c", "/opt/rh/rh-dotnetcore11/root/usr/bin/dotnet build"] CMD ["/bin/bash", "-c", "/opt/rh/rh-dotnetcore11/root/usr/bin/dotnet run"] 然后我尝试通过运行来构buildDocker镜像 docker build -t mvc_docker 其中mvc_docker既是我在运行docker build命令时所在文件夹的名称,也是我正在尝试创build的映像的名称。 在dotnet restore过程中一切看起来不错,但是我在控制台中得到这个错误: 错误:访问path“/opt/app-root/src/project.lock.json”被拒绝。 目前在我的RHEL虚拟机/opt目录中没有app-root目录 – 是否需要手动创build一个,还是期望Docker在Dockerfile指定的目标目录path中创build任何目录? 更新:所以我手动创build/opt/app-root/srcpath,但仍然得到相同的错误,并且当我ls -la在src文件夹中没有文件。 我的Dockerfile内容不正确? 我可以从我的项目文件夹中的bash提示运行dotnet restore ,它成功完成,但也说 锁文件没有改变。 跳过locking文件写入。 但是,这是在我的项目文件夹中的locking文件,而不是在/opt目标文件夹中的任何文件。

在Visual Studio 2017中显示多个Docker容器的交互式控制台

我目前正在开发一个带有多个docker容器的.Net Core-project,其中两个是.NET Core Console应用程序,第三个是RabbitMQ。 我的目标是打开一个控制台窗口,在那里我可以按下至less一个Docker容器中运行的控制台应用程序的input。 我通过右键单击我的控制台应用程序并单击“添加=> Docker支持”来添加docker-support。 这是我的docker-compose-file: version: '3' services: service1: image: service1 build: context: ./Service1 dockerfile: Dockerfile links: – "rabbitmq:rabbit" service2: image: service2 build: context: ./Service2 dockerfile: Dockerfile links: – "rabbitmq:rabbit" rabbitmq: image: "rabbitmq:3-management" ports: – "8082:15672" – "5672:5672" 这是我的docker-compose-override.yml: version: '3' 但是,Visual Studio在运行Service2容器时会进行以下重写: Service2: build: args: source: obj/Docker/empty/ context: C:\Develop\vsts_tfs\Service2 dockerfile: Dockerfile […]

如何创build图像并将图像推送到docker中心

我想推我的微服务dockerhub,但我不知道如何推它到docker集线器, docker login然后即时通讯using docker push然后它去这个消息 The push refers to a repository [docker.io/library/microservicehelloworld] An image does not exist locally with the tag: microservicehelloworld 然后即时通讯使用 docker tag microservicehelloworld microservicehelloworld 并显示这样的错误信息 Error response from daemon: No such image: microservicehelloworld:latest 这里是我的完整解决scheme,是否有任何文件丢失,或者我必须做的东西来创builddocker图像?