开发者

"You have created a service." How did this happen?

开发者 https://www.devze.com 2023-02-16 07:09 出处:网络
When I crea开发者_运维知识库te a new \"WCF Service Application\" in Visual Studio and right-click Service1.svc, I can choose \"View in Browser\". A web browser appears showing http://localhost:50311/S

When I crea开发者_运维知识库te a new "WCF Service Application" in Visual Studio and right-click Service1.svc, I can choose "View in Browser". A web browser appears showing http://localhost:50311/Service1.svc, which says

Service1 Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://localhost:50311/Service1.svc?wsdl
...

The service somehow seems tied to Visual Studio itself, since the web page becomes inaccessible if I close the solution. What's going on? I don't have a web server installed, and I didn't (knowingly) start the service. What is the source of the displayed web page, and why is it on port 50311? Can the page be customized?


What you're seeing is the development web server that starts when you run a debugger instance of a project that requires a web server. (WCF, ASP.NET).

The port 50311 is determined by your project settings (most likely random, but you can specify).

The page for a .svc file is not meant to be customized. Since the service is waiting for a caller, that default page simply tells you that it's running properly.

Keep in mind that WCF offers several binding options that use various protocols (HTTP, TCP). Depending on the protocol that you choose, you will have to host in either IIS, a Windows Service or elsewhere. By default, new services will adopt a binding that works in IIS.

Check out Introduction to Building Windows Communication Foundation Services

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号