首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在内部信息服务中,使用.net的Web不连接mysql db。

在内部信息服务中,使用.net的Web不连接mysql db。
EN

Stack Overflow用户
提问于 2019-03-10 19:28:11
回答 1查看 171关注 0票数 0

我编写了一个连接到mysql数据库并提供api的and服务。当我在视频演播室运行它时,它工作得很好。现在,当我把它放到网络信息服务中时,我希望它能起作用。但是api没有返回。希望运行此api的单页应用程序将给出以下错误

代码语言:javascript
复制
 GET http://localhost:8024/api/Interviewee 500 (Internal Server Error)


angular.js:15536 Possibly unhandled rejection: {"data":{"Message":"An error has occurred.","ExceptionMessage":"Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.","ExceptionType":"System.InvalidOperationException","StackTrace":"   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)\r\n   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)\r\n   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)\r\n   at System.Data.SqlClient.SqlConnection.Open()\r\n   at IntervieweeService.Controllers.IntervieweeController.GetInterviewees() in C:\\Projects\\IntervieweeApp\\IntervieweeService\\IntervieweeService\\Controllers\\IntervieweeController.cs:line 30\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"},"status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://localhost:8024/api/Interviewee","headers":{"Accept":"application/json, text/plain, */*"}},"statusText":"Internal Server Error","xhrStatus":"complete"}
(anonymous) @ angular.js:15536
(anonymous) @ angular.js:11815
processChecks @ angular.js:17946
$digest @ angular.js:19075
$apply @ angular.js:19463
done @ angular.js:13312
completeRequest @ angular.js:13569
requestLoaded @ angular.js:13474
load (async)
(anonymous) @ angular.js:13457
sendReq @ angular.js:13257
serverRequest @ angular.js:12998
processQueue @ angular.js:17914
(anonymous) @ angular.js:17962
$digest @ angular.js:19075
$apply @ angular.js:19463
done @ angular.js:13312
completeRequest @ angular.js:13569
requestLoaded @ angular.js:13474
load (async)
(anonymous) @ angular.js:13457
sendReq @ angular.js:13257
serverRequest @ angular.js:12998
processQueue @ angular.js:17914
(anonymous) @ angular.js:17962
$digest @ angular.js:19075
$apply @ angular.js:19463
bootstrapApply @ angular.js:1945
invoke @ angular.js:5122
doBootstrap @ angular.js:1943
bootstrap @ angular.js:1963
angularInit @ angular.js:1848
(anonymous) @ angular.js:36216
fire @ jquery-2.2.4.js:3187
fireWith @ jquery-2.2.4.js:3317
ready @ jquery-2.2.4.js:3536
completed @ jquery-2.2.4.js:3552

连接串

代码语言:javascript
复制
Server=localhost;Port=8024;Database=intervieweedb;Uid=rrrr;Pwd=111;

我怎么才能把这事做好?谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-11 18:25:33

如果您在http://localhost:8024/api/Interviewee访问您的网站,则端口8024将被您的web服务器使用。连接字符串中的Server=localhost;Port=8024是错误的,因为MySQL需要在不同的端口上运行。

Port连接字符串中的MySQL更改为MySQL服务器的端口号(通常为3306)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55091513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档