在Visual Studio 2010中添加服务引用似乎不起作用

时间:2023-01-17 11:33:35

answer = The problem was simple we had a common lbrary with functions. the service was a new functionality that had been attempted by someone in this common, and was still present in the one referenced by the project. this caused the project to have 2 identical namespaces (one in the common dll and one in the service).

问题很简单,我们有一个普通的带函数的逻辑。这个服务是一个新的功能,这个功能已经被某些人尝试过了,并且仍然存在于项目引用的那个功能中。这导致项目有两个相同的名称空间(一个在公共dll中,一个在服务中)。

We had a problem adding this reference at first because of the rights the service had in IIS. we fixed that problem however, when adding the reference again it seems to only partly add the reference. It does appear in the service list but not in the app config, and it can't be used (intellisense doesn't find it nor does manually typing work).

我们最初在添加这个引用时遇到了问题,因为服务在IIS中有权限。但是,我们解决了这个问题,当再次添加引用时,似乎只添加了部分引用。它确实会出现在服务列表中,但不会出现在应用程序配置中,也不能使用(intellisense找不到它,也不能手动输入)。

if we try this in a diffrent project it does add perfectly and wehave tried deleting anything we can find about the reference before readding it (the subfolder, opening the project in notepad and deleting all references there) but nothing seems to work.

如果我们在一个不同的项目中尝试这一点,它确实可以完美地添加,并且我们已经尝试在读取引用之前删除任何我们能找到的引用(子文件夹,在记事本中打开项目并删除所有引用),但是似乎没有任何效果。

when deleting and readding a diffrent service to this project in similar ways and that works and we can add it to diffrent projects in the same solution, just not in this project.

当以类似的方式删除和读取这个项目的不同服务时,我们可以将它添加到同一个解决方案中的不同项目中,而不是在这个项目中。

Anyone have any idea why this could happen and possible solutions?

有人知道为什么会发生这种情况吗?

EDIT: When we recreated the project in the same solution and dragged all classes etc over we can add and remove this reference as we want. although this would count as a solution i would actually like to know why things happened like they happened rather then recreate projects when things seem to get stuck. Is there a cache or something in visual studio that could cause this?

编辑:当我们在相同的解决方案中重新创建项目,并拖出所有的类等时,我们可以添加并删除我们想要的引用。尽管这可以算作一种解决方案,但我确实想知道为什么事情会像它们发生一样发生,而不是在事情似乎陷入僵局时重新创建项目。在visual studio中有缓存或其他东西会导致这种情况吗?

Also at times it takes longer (or never finds it) to find the service then at other times where it does so in <1 second. the best way to get it seems to stop and start the search. not sure if it is related but it does seem like a difference between my PC and the other one we use as well.

此外,有时要花更长的时间(或永远找不到它)才能找到服务,而在另一些时候,它在<1秒内找到服务。得到它的最好方法似乎是停止并开始搜索。我不确定它是否相关,但它确实像是我的电脑和我们使用的另一台电脑之间的区别。

Edit2: we have also tried deleting the services folder, re-adding services recreates the folder and adds this reference it does not work. if we add a different service after the deletion of the folder, that reference does work. adding the reference we want to add after that does not make it work.

Edit2:我们还尝试过删除services文件夹,重新添加服务以重新创建文件夹,并添加它不能工作的引用。如果我们在删除文件夹之后添加另一个服务,那么这个引用就可以工作了。在此之后添加我们想要添加的引用并不会使它工作。

Edit3: in an additional project, i can add it once where it works however deleting the reference and then re-adding it makes it so it doesn't work again. a similar reference to this one i can delete and re-add as many times as i want within the same project and it keeps working. this one reference keeps not being found when re-added after a delete and giving the "Type or namespace can't be found" error.

Edit3:在另一个项目中,我可以在它工作的地方添加它,但是删除引用,然后重新添加它,这样它就不会再工作了。类似的引用,我可以在同一个项目中删除和重新添加尽可能多的次数,并且它会继续工作。此引用在删除后重新添加时不会被发现,并且提供“类型或名称空间不能被发现”错误。

We also tried changing the solution and projects GUIDs and still, it does not add the service reference correctly in the project.)

我们还尝试了更改解决方案和项目指南,但仍然没有在项目中正确地添加服务引用。

**Edit4: When turning off the Reuse types in referenced Assemblies in Configure Service Reference.. Dialog box visual studio adds the information to the Reference.cs page leaving that page empty. unticking this box does add all references to that file and makes the service reference work.

**Edit4:在配置服务引用中关闭引用程序集中的重用类型。对话框visual studio将信息添加到引用中。cs页保持该页为空。取消勾选此框将向该文件添加所有引用,并使服务引用正常工作。

However i can use most of the reference, i am missing the entry point meaning i can't run it.

但是我可以使用大部分引用,我丢失了入口点,这意味着我不能运行它。

this is the dialog box where i untick to be able to get a tad further.

这是一个对话框,在这里我可以取消勾选以获得更多的信息。

在Visual Studio 2010中添加服务引用似乎不起作用

3 个解决方案

#1


2  

When I worked with Service References I found out that in addition to remove the Service Reference Folder I had to remove the reference in app.config, along these lines:

当我使用服务引用时,我发现除了删除服务引用文件夹之外,我还必须删除app.config中的引用,按照以下步骤:

<system.serviceModel>
    <bindings>
    a lot of lines...
    </client>
</system.serviceModel>

Could be a help...
Gorgen

可能是一个帮助……Gorgen

#2


2  

Finally really solved this. as Mike Cheel said in his comment. ill reprovide the link

最后真的解决了这个。正如Mike Cheel在评论中所说的。生病reprovide链接

The problem was simple we had a common lbrary with functions. the service was a new functionality that had been attempted by someone in this common, and was still present in the one referenced by the project.

问题很简单,我们有一个常见的有功能的lbrary。这个服务是一个新的功能,这个功能已经被某些人尝试过了,并且仍然存在于项目引用的那个功能中。

this caused the project to have 2 identical namespaces (one in the common dll and one in the service).

这导致项目有两个相同的名称空间(一个在公共dll中,一个在服务中)。

So, simply, build a new common dll, added it to the project and now it works perfectly.

因此,简单地说,构建一个新的公共dll,将它添加到项目中,现在它可以完美地工作了。

#3


1  

I would start by deleting the whole "Service References" folder that is generated when Visual Studio is adding service reference.

首先,我将删除在Visual Studio添加服务引用时生成的整个“服务引用”文件夹。

Did you try it?

你试一试吗?

#1


2  

When I worked with Service References I found out that in addition to remove the Service Reference Folder I had to remove the reference in app.config, along these lines:

当我使用服务引用时,我发现除了删除服务引用文件夹之外,我还必须删除app.config中的引用,按照以下步骤:

<system.serviceModel>
    <bindings>
    a lot of lines...
    </client>
</system.serviceModel>

Could be a help...
Gorgen

可能是一个帮助……Gorgen

#2


2  

Finally really solved this. as Mike Cheel said in his comment. ill reprovide the link

最后真的解决了这个。正如Mike Cheel在评论中所说的。生病reprovide链接

The problem was simple we had a common lbrary with functions. the service was a new functionality that had been attempted by someone in this common, and was still present in the one referenced by the project.

问题很简单,我们有一个常见的有功能的lbrary。这个服务是一个新的功能,这个功能已经被某些人尝试过了,并且仍然存在于项目引用的那个功能中。

this caused the project to have 2 identical namespaces (one in the common dll and one in the service).

这导致项目有两个相同的名称空间(一个在公共dll中,一个在服务中)。

So, simply, build a new common dll, added it to the project and now it works perfectly.

因此,简单地说,构建一个新的公共dll,将它添加到项目中,现在它可以完美地工作了。

#3


1  

I would start by deleting the whole "Service References" folder that is generated when Visual Studio is adding service reference.

首先,我将删除在Visual Studio添加服务引用时生成的整个“服务引用”文件夹。

Did you try it?

你试一试吗?