我正在尝试发布一个网络服务,我收到的错误是:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
我有以下详情:
Module DefaultDocumentModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x800700b7
Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'value' set to 'KWebService.asmx'
Config File \\?\C:\inetpub\wwwroot\KWebService\web.config
Requested URL http://localhost:80/KWebService/KWebService
Physical Path C:\inetpub\wwwroot\KWebService
Logon Method Anonymous
Logon User Anonymous
指向行:
13: <files>
14: <add value="KWebService.asmx" />
15: </files>
我已在路径C:\ inetpub \ wwwroot \ KWebService中保存了KWebService文件夹。 我的web.config是:
<?xml version="1.0" encoding="utf-8"?>
<!--
Pour plus d'informations sur la configuration de votre application ASP.NET, consultez
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime targetFramework="4.0" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="KWebService.asmx" />
</files>
</defaultDocument>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
我的IIS管理器有这个屏幕截图:
我使用的端口号是80,targetFramework =“4.0”,在应用程序池中我有这个版本的快照:
有人可以让我知道问题的原因吗?
答案 0 :(得分:0)
您收到此错误是因为您在更高级别的配置文件中有类似的条目。它可以在服务器或网站级别。尝试将以下内容放在 import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.appcompat.widget.AppCompatImageView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PolygonView extends FrameLayout {
protected Context context;
private Paint paint;
private AppCompatImageView pointer1;
private AppCompatImageView pointer2;
private AppCompatImageView pointer3;
private AppCompatImageView pointer4;
private AppCompatImageView midPointer13;
private AppCompatImageView midPointer12;
private AppCompatImageView midPointer34;
private AppCompatImageView midPointer24;
private PolygonView polygonView;
public PolygonView(Context context) {
super(context);
this.context = context;
init();
}
public PolygonView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init();
}
public PolygonView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
init();
}
private void init() {
polygonView = this;
pointer1 = getImageView(0, 0);
pointer2 = getImageView(getWidth(), 0);
pointer3 = getImageView(0, getHeight());
pointer4 = getImageView(getWidth(), getHeight());
midPointer13 = getImageView(0, getHeight() / 2);
midPointer13.setOnTouchListener(new MidPointTouchListenerImpl(pointer1, pointer3));
midPointer12 = getImageView(0, getWidth() / 2);
midPointer12.setOnTouchListener(new MidPointTouchListenerImpl(pointer1, pointer2));
midPointer34 = getImageView(0, getHeight() / 2);
midPointer34.setOnTouchListener(new MidPointTouchListenerImpl(pointer3, pointer4));
midPointer24 = getImageView(0, getHeight() / 2);
midPointer24.setOnTouchListener(new MidPointTouchListenerImpl(pointer2, pointer4));
addView(pointer1);
addView(pointer2);
addView(midPointer13);
addView(midPointer12);
addView(midPointer34);
addView(midPointer24);
addView(pointer3);
addView(pointer4);
initPaint();
}
@Override
protected void attachViewToParent(View child, int index, ViewGroup.LayoutParams params) {
super.attachViewToParent(child, index, params);
}
private void initPaint() {
paint = new Paint();
paint.setColor(getResources().getColor(R.color.colorAccent));
paint.setStrokeWidth(2);
paint.setAntiAlias(true);
}
public Map<Integer, PointF> getPoints() {
List<PointF> points = new ArrayList<PointF>();
points.add(new PointF(pointer1.getX(), pointer1.getY()));
points.add(new PointF(pointer2.getX(), pointer2.getY()));
points.add(new PointF(pointer3.getX(), pointer3.getY()));
points.add(new PointF(pointer4.getX(), pointer4.getY()));
return getOrderedPoints(points);
}
public Map<Integer, PointF> getOrderedPoints(List<PointF> points) {
PointF centerPoint = new PointF();
int size = points.size();
for (PointF pointF : points) {
centerPoint.x += pointF.x / size;
centerPoint.y += pointF.y / size;
}
Map<Integer, PointF> orderedPoints = new HashMap<>();
for (PointF pointF : points) {
int index = -1;
if (pointF.x < centerPoint.x && pointF.y < centerPoint.y) {
index = 0;
} else if (pointF.x > centerPoint.x && pointF.y < centerPoint.y) {
index = 1;
} else if (pointF.x < centerPoint.x && pointF.y > centerPoint.y) {
index = 2;
} else if (pointF.x > centerPoint.x && pointF.y > centerPoint.y) {
index = 3;
}
orderedPoints.put(index, pointF);
}
return orderedPoints;
}
public void setPoints(Map<Integer, PointF> pointFMap) {
if (pointFMap.size() == 4) {
setPointsCoordinates(pointFMap);
}
}
private void setPointsCoordinates(Map<Integer, PointF> pointFMap) {
pointer1.setX(pointFMap.get(0).x);
pointer1.setY(pointFMap.get(0).y);
pointer2.setX(pointFMap.get(1).x);
pointer2.setY(pointFMap.get(1).y);
pointer3.setX(pointFMap.get(2).x);
pointer3.setY(pointFMap.get(2).y);
pointer4.setX(pointFMap.get(3).x);
pointer4.setY(pointFMap.get(3).y);
// Log.e("pointer1",pointer1.getX()+" "+pointer1.getY()+" ");
// Log.e("pointer2",pointer2.getX()+" "+pointer2.getY()+" ");
// Log.e("pointer3",pointer3.getX()+" "+pointer3.getY()+" ");
// Log.e("pointer4",pointer4.getX()+" "+pointer4.getY()+" ");
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
canvas.drawLine(pointer1.getX() + (pointer1.getWidth() / 2), pointer1.getY() + (pointer1.getHeight() / 2), pointer3.getX() + (pointer3.getWidth() / 2), pointer3.getY() + (pointer3.getHeight() / 2), paint);
canvas.drawLine(pointer1.getX() + (pointer1.getWidth() / 2), pointer1.getY() + (pointer1.getHeight() / 2), pointer2.getX() + (pointer2.getWidth() / 2), pointer2.getY() + (pointer2.getHeight() / 2), paint);
canvas.drawLine(pointer2.getX() + (pointer2.getWidth() / 2), pointer2.getY() + (pointer2.getHeight() / 2), pointer4.getX() + (pointer4.getWidth() / 2), pointer4.getY() + (pointer4.getHeight() / 2), paint);
canvas.drawLine(pointer3.getX() + (pointer3.getWidth() / 2), pointer3.getY() + (pointer3.getHeight() / 2), pointer4.getX() + (pointer4.getWidth() / 2), pointer4.getY() + (pointer4.getHeight() / 2), paint);
midPointer13.setX(pointer3.getX() - ((pointer3.getX() - pointer1.getX()) / 2));
midPointer13.setY(pointer3.getY() - ((pointer3.getY() - pointer1.getY()) / 2));
midPointer24.setX(pointer4.getX() - ((pointer4.getX() - pointer2.getX()) / 2));
midPointer24.setY(pointer4.getY() - ((pointer4.getY() - pointer2.getY()) / 2));
midPointer34.setX(pointer4.getX() - ((pointer4.getX() - pointer3.getX()) / 2));
midPointer34.setY(pointer4.getY() - ((pointer4.getY() - pointer3.getY()) / 2));
midPointer12.setX(pointer2.getX() - ((pointer2.getX() - pointer1.getX()) / 2));
midPointer12.setY(pointer2.getY() - ((pointer2.getY() - pointer1.getY()) / 2));
}
private AppCompatImageView getImageView(int x, int y) {
AppCompatImageView imageView = new AppCompatImageView(context);
LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imageView.setLayoutParams(layoutParams);
imageView.setImageResource(R.drawable.circle);
imageView.setX(x);
imageView.setY(y);
imageView.setOnTouchListener(new TouchListenerImpl());
return imageView;
}
private class MidPointTouchListenerImpl implements OnTouchListener {
PointF DownPT = new PointF(); // Record Mouse Position When Pressed Down
PointF StartPT = new PointF(); // Record Start Position of 'img'
private AppCompatImageView mainPointer1;
private AppCompatImageView mainPointer2;
public MidPointTouchListenerImpl(AppCompatImageView mainPointer1, AppCompatImageView mainPointer2) {
this.mainPointer1 = mainPointer1;
this.mainPointer2 = mainPointer2;
}
@Override
public boolean onTouch(View v, MotionEvent event) {
int eid = event.getAction();
switch (eid) {
case MotionEvent.ACTION_MOVE:
PointF mv = new PointF(event.getX() - DownPT.x, event.getY() - DownPT.y);
if (Math.abs(mainPointer1.getX() - mainPointer2.getX()) > Math.abs(mainPointer1.getY() - mainPointer2.getY())) {
if (((mainPointer2.getY() + mv.y + v.getHeight() < polygonView.getHeight()) && (mainPointer2.getY() + mv.y > 0))) {
v.setX((int) (StartPT.y + mv.y));
StartPT = new PointF(v.getX(), v.getY());
mainPointer2.setY((int) (mainPointer2.getY() + mv.y));
}
if (((mainPointer1.getY() + mv.y + v.getHeight() < polygonView.getHeight()) && (mainPointer1.getY() + mv.y > 0))) {
v.setX((int) (StartPT.y + mv.y));
StartPT = new PointF(v.getX(), v.getY());
mainPointer1.setY((int) (mainPointer1.getY() + mv.y));
}
} else {
if ((mainPointer2.getX() + mv.x + v.getWidth() < polygonView.getWidth()) && (mainPointer2.getX() + mv.x > 0)) {
v.setX((int) (StartPT.x + mv.x));
StartPT = new PointF(v.getX(), v.getY());
mainPointer2.setX((int) (mainPointer2.getX() + mv.x));
}
if ((mainPointer1.getX() + mv.x + v.getWidth() < polygonView.getWidth()) && (mainPointer1.getX() + mv.x > 0)) {
v.setX((int) (StartPT.x + mv.x));
StartPT = new PointF(v.getX(), v.getY());
mainPointer1.setX((int) (mainPointer1.getX() + mv.x));
}
}
break;
case MotionEvent.ACTION_DOWN:
DownPT.x = event.getX();
DownPT.y = event.getY();
StartPT = new PointF(v.getX(), v.getY());
break;
case MotionEvent.ACTION_UP:
int color = 0;
if (isValidShape(getPoints())) {
color = getResources().getColor(R.color.colorAccent);
} else {
color = getResources().getColor(R.color.orange);
}
paint.setColor(color);
break;
default:
break;
}
polygonView.invalidate();
return true;
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
public boolean isValidShape(Map<Integer, PointF> pointFMap) {
return pointFMap.size() == 4;
}
private class TouchListenerImpl implements OnTouchListener {
PointF DownPT = new PointF(); // Record Mouse Position When Pressed Down
PointF StartPT = new PointF(); // Record Start Position of 'img'
@Override
public boolean onTouch(View v, MotionEvent event) {
int eid = event.getAction();
switch (eid) {
case MotionEvent.ACTION_MOVE:
PointF mv = new PointF(event.getX() - DownPT.x, event.getY() - DownPT.y);
if (((StartPT.x + mv.x + v.getWidth()) < polygonView.getWidth() && (StartPT.y + mv.y + v.getHeight() < polygonView.getHeight())) && ((StartPT.x + mv.x) > 0 && StartPT.y + mv.y > 0)) {
v.setX((int) (StartPT.x + mv.x));
v.setY((int) (StartPT.y + mv.y));
StartPT = new PointF(v.getX(), v.getY());
}
break;
case MotionEvent.ACTION_DOWN:
DownPT.x = event.getX();
DownPT.y = event.getY();
StartPT = new PointF(v.getX(), v.getY());
break;
case MotionEvent.ACTION_UP:
int color = 0;
if (isValidShape(getPoints())) {
color = getResources().getColor(R.color.colorAccent);
} else {
color = getResources().getColor(R.color.orange);
}
paint.setColor(color);
break;
default:
break;
}
polygonView.invalidate();
return true;
}
}
}
文件中的标记下方。
web.config
如果您不想放置上述条目,那么您也可以尝试在更高级别的配置文件(如 <remove name="KWebService.asmx" />
)中找到重复的条目,如果不需要,则将其从那里删除。
答案 1 :(得分:-1)
Erreur HTTP 500.19 - 内部服务器错误
您必须检查&#34;&#34;版权所有CLR .NET&#34;&#34;或&#34; .NET版本&#34;